|TensorFlow 1 version||View source on GitHub|
Return the elements, either from
y, depending on the
Compat aliases for migration
See Migration guide for more details.
tf.where( condition, x=None, y=None, name=None )
Used in the notebooks
|Used in the guide||Used in the tutorials|
y are None, then this operation returns the coordinates of
true elements of
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 input. Indices are output in row-major
If both non-None,
y must be broadcastable to the same
condition tensor acts as a mask that chooses, based on the value at each
element, whether the corresponding element / row in the output should be taken
x (if true) or
y (if false).
x: A Tensor which is of the same type as
y, and may be broadcastable with
y: A Tensor which is of the same type as
x, and may be broadcastable with
name: A name of the operation (optional).
Tensor with the same type as
y, and shape that
is broadcast from
y are non-None.
Tensor with shape
ValueError: When exactly one of