vt::where#

template<typename T, size_t N, size_t M>
Tensor<T, N> vt::where(const Tensor<bool, M> &cond, const Tensor<T, N> &x, const Tensor<T, N> &y)#

Return elements chosen from x or y depending on condition.

Template Parameters:
  • T – Data type of the tensor.

  • N – Number of dimensions of the tensor.

  • M – Number of dimensions of the condition tensor.

Parameters:
  • cond – The condition tensor.

  • x – The tensor object to choose elements from when condition is true.

  • y – The tensor object to choose elements from when condition is false.

Returns:

Tensor: The result tensor.

template<typename T, size_t N, size_t M>
Tensor<T, N> vt::where(const Tensor<bool, M> &cond, const T x, const Tensor<T, N> &y)#

Return elements chosen from x or y depending on condition.

Template Parameters:
  • T – Data type of the tensor.

  • N – Number of dimensions of the tensor.

  • M – Number of dimensions of the condition tensor.

Parameters:
  • cond – The condition tensor.

  • x – A constant value to choose when condition is true.

  • y – The tensor object to choose elements from when condition is false.

Returns:

Tensor: The result tensor.

template<typename T, size_t N, size_t M>
Tensor<T, N> vt::where(const Tensor<bool, M> &cond, const Tensor<T, N> &x, const T y)#

Return elements chosen from x or y depending on condition.

Template Parameters:
  • T – Data type of the tensor.

  • N – Number of dimensions of the tensor.

  • M – Number of dimensions of the condition tensor.

Parameters:
  • cond – The condition tensor.

  • x – The tensor object to choose elements from when condition is true.

  • y – A constant value to choose when condition is false.

Returns:

Tensor: The result tensor.