where

dragon.where(
  inputs,
  **kwargs
)[source]

Select the elements from two branches under the condition.

\[\text{out}_{i} = \begin{cases} \text{input1}_{i}, & \text{ if } \text{condition}_{i} \\ \text{input2}_{i}, & \text{ otherwise } \end{cases} \]

Return the index of True elements, if only the condition is given.

Parameters:
  • inputs (Sequence[dragon.Tensor]) – The input1, input2 and condition tensor.
Returns:

dragon.Tensor – The output tensor.

See also

dragon.nonzero()