Skip to main content
Log in

Mojo function

select

select(condition: Symbol, x: Symbol, y: Symbol, location: Optional[_SourceLocation] = #kgen.none) -> Symbol

Returns condition ? x : y (element-wise), where cond, x and y are input tensors.

Args:

  • ​condition (Symbol): The condition tensor to use for selecting elementwise values.
  • ​x (Symbol): If the condition is true at a position, the value from the same position in this tensor will be selected.
  • ​y (Symbol): If the condition is false at a position, the value from the same position in this tensor will be selected.
  • ​location (Optional[_SourceLocation]): An optional location for a more specific error message.

Returns:

A new symbolic tensor holding either values from either x or y, based on the elements in condition.

Was this page helpful?