NonZero

NonZero - 13

版本

  • 名称: NonZero (GitHub)

  • : main

  • 起始版本: 13

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此算子版本自 版本 13 起可用。

摘要

返回非零元素的索引(按行主序 - 按维度)。NonZero 的行为类似于 numpy.nonzero: https://docs.scipy.org.cn/doc/numpy/reference/generated/numpy.nonzero.html,但对于标量输入,NonZero 产生的输出形状是 (0, N) 而不是 (1, N),这与 NumPy 的行为不同。

输入

  • X (异构) - T

    输入

输出

  • Y (异构) - tensor(int64)

    输出

类型约束

  • T 包含 ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) )

    约束为所有张量类型。

NonZero - 9

版本

  • 名称: NonZero (GitHub)

  • : main

  • 起始版本: 9

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此算子版本自 版本 9 起可用。

摘要

返回非零元素的索引(按行主序 - 按维度)。NonZero 的行为类似于 numpy.nonzero: https://docs.scipy.org.cn/doc/numpy/reference/generated/numpy.nonzero.html,但对于标量输入,NonZero 产生的输出形状是 (0, N) 而不是 (1, N),这与 NumPy 的行为不同。

输入

  • X (异构) - T

    输入

输出

  • Y (异构) - tensor(int64)

    输出

类型约束

  • T 包含 ( tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) )

    约束为所有张量类型。