vt::all#
-
template<typename T, size_t N>
bool vt::all(const Tensor<T, N> &tensor)# Check if all elements of the tensor are true. thrust::all_of utilizes transform_reduce algorithm to check if all elements are true. Looks like if the tensor is sliced, the iterator index will go beyond the tensor size, which will cause the function to return wrong answer. The workaround is to use thrust::count_if to count the number of true elements.
- Template Parameters:
T – Data type of the tensor.
N – Number of dimensions of the tensor.
- Parameters:
tensor – The tensor object.
- Returns:
bool: True if all elements are true, false otherwise.
-
template<typename T, size_t N>
Tensor<bool, N - 1> vt::all(const Tensor<T, N> &tensor, int axis)# Check if all elements of the tensor are true along the given axis.
- Template Parameters:
T – Data type of the tensor.
N – Number of dimensions of the tensor.
- Parameters:
tensor – The tensor object.
axis – The axis to check if all elements are true.
- Returns:
Tensor<bool, N-1>: The result tensor.