Function burn_tensor::argwhere

source ·
pub fn argwhere<B: Backend, const D: usize>(
    tensor: BoolTensor<B, D>
) -> IntTensor<B, 2>
Expand description

Compute the indices of the elements that are non-zero, grouped by element.

§Arguments

  • tensor - The input tensor.

§Returns

A vector of tensors, one for each dimension of the given tensor, containing the indices of the non-zero elements in that dimension.

§Remarks

This is a fallback solution that used only when the backend doesn’t have the corresponding implementation. Ideally, it is supposed to be implemented by the backend and the backend implementation will be resolved by static dispatch. It is not designed for direct usage by users, and not recommended to import or use this function directly.