Function nonzero

  • Determine the indices of elements that are non-zero. There is a method version of this static function: Tensor.nonzero.

    Remarks

    Indices correspond to a flattened version of the input tensor.

    Example

      const t = sm.randn([100])

    // equivalent calls
    const a = t.nonzero()
    const b = sm.nonzero(t)

    Returns

    • A new Tensor composed of the flattened indices of the non-zero elements in the input

    Parameters

    • tensor: Tensor

      Tensor whose values will be used to find indices

    Returns Tensor

Generated using TypeDoc