|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 )
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 order.
If both non-None,
y must have the same shape. The
condition tensor must be a scalar if
y are scalar. If
y are tensors of higher rank, then
condition must be either a vector with size matching the first dimension of
x, or must have the same shape as
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 from
x (if true) or
y (if false).
condition is a vector and
y are higher rank matrices, then it chooses which row (outer dimension) to copy from
condition has the same shape as
y, then it chooses which element to copy from
| || A |
| || A Tensor which may have the same shape as |
| || A |
| ||A name of the operation (optional)|
| A |
| || When exactly one of |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.