# Where

public final class **Where** Returns locations of nonzero / true values in a tensor.


This operation returns the coordinates of true elements in \`condition\`. The
coordinates are returned in a 2-D tensor where the first dimension (rows)
represents the number of true elements, and the second dimension (columns)
represents the coordinates of the true elements. Keep in mind, the shape of
the output tensor can vary depending on how many true values there are in
\`condition\`. Indices are output in row-major order.


For example:

    # 'input' tensor is [[True, False]
     #                    [True, False]]
     # 'input' has two true values, so output has two coordinates.
     # 'input' has rank of 2, so coordinates have two indices.
     where(input) ==&gt; [[0, 0],
                       [1, 0]]
     
     # `condition` tensor is [[[True, False]
     #                     [True, False]]
     #                    [[False, True]
     #                     [False, True]]
     #                    [[False, False]
     #                     [False, True]]]
     # 'input' has 5 true values, so output has 5 coordinates.
     # 'input' has rank of 3, so coordinates have three indices.
     where(input) ==&gt; [[0, 0, 0],
                       [0, 1, 0],
                       [1, 0, 1],
                       [1, 1, 1],
                       [2, 1, 1]]
     
     # `condition` tensor is [[[1.5,  0.0]
     #                     [-0.5, 0.0]]
     #                    [[0.0,  0.25]
     #                     [0.0,  0.75]]
     #                    [[0.0,  0.0]
     #                     [0.0,  0.01]]]
     # 'input' has 5 nonzero values, so output has 5 coordinates.
     # 'input' has rank of 3, so coordinates have three indices.
     where(input) ==&gt; [[0, 0, 0],
                       [0, 1, 0],
                       [1, 0, 1],
                       [1, 1, 1],
                       [2, 1, 1]]
     
     # `condition` tensor is [[[1.5 + 0.0j, 0.0  + 0.0j]
     #                     [0.0 + 0.5j, 0.0  + 0.0j]]
     #                    [[0.0 + 0.0j, 0.25 + 1.5j]
     #                     [0.0 + 0.0j, 0.75 + 0.0j]]
     #                    [[0.0 + 0.0j, 0.0  + 0.0j]
     #                     [0.0 + 0.0j, 0.01 + 0.0j]]]
     # 'input' has 5 nonzero magnitude values, so output has 5 coordinates.
     # 'input' has rank of 3, so coordinates have three indices.
     where(input) ==&gt; [[0, 0, 0],
                       [0, 1, 0],
                       [1, 0, 1],
                       [1, 1, 1],
                       [2, 1, 1]]
     
<br />

<br />

<br />

### Public Methods

|---|---|
| [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<Long\> | [asOutput](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/Where#asOutput())() Returns the symbolic handle of a tensor. |
| static \<T\> [Where](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/Where) | [create](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/Where#create(org.tensorflow.op.Scope,%20org.tensorflow.Operand<T>))([Scope](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<T\> condition) Factory method to create a class wrapping a new Where operation. |
| [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<Long\> | [index](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/Where#index())() |

### Inherited Methods

From class [org.tensorflow.op.PrimitiveOp](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp)

|---|---|
| final boolean | [equals](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#equals(java.lang.Object))(Object obj) |
| final int | [hashCode](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#hashCode())() |
| [Operation](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operation) | [op](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#op())() Returns the underlying `https://www.tensorflow.org/api_docs/java/org/tensorflow/Operation` |
| final String | [toString](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#toString())() |

From class java.lang.Object

|---|---|
| boolean | equals(Object arg0) |
| final Class\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| String | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

From interface [org.tensorflow.Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)

|---|---|
| abstract [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<Long\> | [asOutput](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand#asOutput())() Returns the symbolic handle of a tensor. |

## Public Methods

#### public [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<Long\>
**asOutput**
()

Returns the symbolic handle of a tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is
used to obtain a symbolic handle that represents the computation of the input.

<br />

#### public static [Where](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/Where)
**create**
([Scope](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<T\> condition)

Factory method to create a class wrapping a new Where operation.

##### Parameters

| scope | current scope |
|---|---|

##### Returns

- a new instance of Where

#### public [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<Long\>
**index**
()

<br />