message: Define where_v2 in array_ops.py
diff: @@ -2631,6 +2631,45 @@ def where(condition, x=None, y=None, name=None):
  raise ValueError("x and y must both be non-None or both be None.")
  +def where_v2(condition, x=None, y=None, name=None):
  + """Return the elements, either from `x` or `y`, depending on the `condition`.
  + If both `x` and `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, `condition`, `x` and `y` must be broadcastable to the same
  + shape.
  + The `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).
  + Args:
  + condition: A `Tensor` of type `bool`
  + x: A Tensor which is of the same type as `y`, and may be
  + broadcastable with `condition` and `y`.
  + y: A Tensor which is of the same type as `x`, and may be
  + broadcastable with `condition` and `x`.
  + name: A name of the operation (optional).
  + Returns:
  + A `Tensor` with the same type as `x` and `y`, and shape that
  + is broadcasted from `condition`, `x`, and `y`, if `x`, `y` are non-None.
  + A `Tensor` with shape `(num_true, dim_size(condition))`.
  + Raises:
  + ValueError: When exactly one of `x` or `y` is non-None.
  + """
  + if x is None and y is None:
  + with ops.name_scope(name, "Where", [condition]) as name:
  + condition = ops.convert_to_tensor(
  + condition, preferred_dtype=dtypes.bool, name="condition")
  + return gen_array_ops.where(condition=condition, name=name)
  + elif x is not None and y is not None:
  + return gen_math_ops.select_v2(condition=condition, t=x, e=y, name=name)
  + else:
  + raise ValueError("x and y must both be non-None or both be None.")
  +
  +
  # pylint: disable=redefined-builtin
  @tf_export("reverse_sequence")
  @deprecation.deprecated_args(
  