压缩

压缩 - 11

版本

  • 名称: Compress (GitHub)

  • 域名: main

  • since_version: 11

  • 函数: False

  • support_level: SupportType.COMMON

  • 形状推断: True

此版本的运算符自版本11起可用。

摘要

从输入张量中沿着给定轴选择切片,其中条件在每个轴索引处评估为True。 如果未提供轴,则在选择元素之前将输入展平。 Compress的行为类似于numpy.compress:https://docs.scipy.org/doc/numpy/reference/generated/numpy.compress.html

属性

  • axis - INT :

    (可选)沿其进行切片的轴。如果未指定,则在选择元素之前将输入展平。负值表示从后向前计算维度。可接受的范围是 [-r, r-1],其中 r = rank(input)。

输入

  • 输入 (异构) - T:

    秩为 r >= 1 的张量。

  • 条件 (异构) - T1:

    布尔值的Rank 1张量,用于指示要选择的切片或数据元素。如果未指定轴,则其长度可以小于沿轴的输入长度或展平的输入大小。在这种情况下,超出条件长度的数据切片或元素将被丢弃。

输出

  • 输出 (异构) - T:

    如果指定了轴,则输出为秩为r的张量。否则,输出为秩为1的张量。

类型约束

  • 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) ):

    将输入和输出类型限制为所有张量类型。

  • T1 在 ( tensor(bool) ) 中:

    限制为布尔张量。

压缩 - 9

版本

  • 名称: Compress (GitHub)

  • 域名: main

  • since_version: 9

  • 函数: False

  • support_level: SupportType.COMMON

  • 形状推断: False

此版本的运算符自版本9起可用。

摘要

从输入张量中沿着给定轴选择切片,其中条件对每个轴索引评估为True。 如果未提供轴,则在选择元素之前将输入展平。 Compress的行为类似于numpy.compress:https://docs.scipy.org/doc/numpy/reference/generated/numpy.compress.html

属性

  • axis - INT :

    (可选)沿其进行切片的轴。如果未指定,则在选择元素之前将输入展平。

输入

  • 输入 (异构) - T:

    秩为 r >= 1 的张量。

  • 条件 (异构) - T1:

    布尔值的Rank 1张量,用于指示要选择的切片或数据元素。如果未指定轴,则其长度可以小于沿轴的输入长度或展平的输入大小。在这种情况下,超出条件长度的数据切片或元素将被丢弃。

输出

  • 输出 (异构) - T:

    如果指定了轴,则输出为秩为r的张量。否则,输出为秩为1的张量。

类型约束

  • 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) ):

    将输入和输出类型限制为所有张量类型。

  • T1 在 ( tensor(bool) ) 中:

    限制为布尔张量。