where¶
dragon.vm.torch.
where
(
condition,
x,
y
)[source]¶Select the elements from two branches under the condition.
\[\text{out}_{i} = \begin{cases} \text{x}_{i}, & \text{ if } \text{condition}_{i} \\ \text{y}_{i}, & \text{ otherwise } \end{cases} \]- Parameters:
- condition (dragon.vm.torch.Tensor) – The condition tensor.
- x (dragon.vm.torch.Tensor) – The elements for
True
branch. - y (dragon.vm.torch.Tensor) – The elements for
False
branch.
- Returns:
dragon.vm.torch.Tensor – The output tensor.