展平 (Flatten)

展平 (Flatten) - 24

版本

  • 名称: 展平 (Flatten) (GitHub)

  • : main

  • 起始版本24

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此版本的操作符已可用于版本 24 及以上

摘要

将输入张量展平为二维矩阵。如果输入张量形状为 (d_0, d_1, … d_n),则输出形状将为 (d_0 X d_1 … d_(axis-1), d_axis X d_(axis+1) … X dn)。

属性

  • 轴 - INT(默认值为 '1'

    指定在输出的外维中应展平到哪个输入维度(不包括)。axis 的值必须在 [-r, r] 范围内,其中 r 是输入张量的秩。负值表示从后向前计数维度。当 axis = 0 时,输出张量的形状为 (1, (d_0 X d_1 … d_n)),其中输入张量的形状为 (d_0, d_1, … d_n)。

输入

  • 输入 (异构) - T

    秩 >= axis 的张量。

输出

  • 输出 (异构) - T

    一个二维张量,包含输入张量的内容,其中输入维度直到 axis 被展平到输出的外维,其余输入维度被展平到输出的内维。

类型约束

  • T 包含 ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(float4e2m1), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(float8e8m0), tensor(int16), tensor(int32), tensor(int4), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint4), tensor(uint64), tensor(uint8) )

    将输入和输出限制为所有张量类型,直至 IRv12。

展平 (Flatten) - 23

版本

  • 名称: 展平 (Flatten) (GitHub)

  • : main

  • 起始版本23

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此版本的操作符已可用于版本 23 及以上

摘要

将输入张量展平为二维矩阵。如果输入张量形状为 (d_0, d_1, … d_n),则输出形状将为 (d_0 X d_1 … d_(axis-1), d_axis X d_(axis+1) … X dn)。

属性

  • 轴 - INT(默认值为 '1'

    指定在输出的外维中应展平到哪个输入维度(不包括)。axis 的值必须在 [-r, r] 范围内,其中 r 是输入张量的秩。负值表示从后向前计数维度。当 axis = 0 时,输出张量的形状为 (1, (d_0 X d_1 … d_n)),其中输入张量的形状为 (d_0, d_1, … d_n)。

输入

  • 输入 (异构) - T

    秩 >= axis 的张量。

输出

  • 输出 (异构) - T

    一个二维张量,包含输入张量的内容,其中输入维度直到 axis 被展平到输出的外维,其余输入维度被展平到输出的内维。

类型约束

  • T 包含 ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(float4e2m1), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int16), tensor(int32), tensor(int4), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint4), tensor(uint64), tensor(uint8) )

    将输入和输出限制为所有张量类型,直至 IRv10。

展平 (Flatten) - 21

版本

  • 名称: 展平 (Flatten) (GitHub)

  • : main

  • since_version: 21

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

此版本的操作符自 版本 21 起可用。

摘要

将输入张量展平为二维矩阵。如果输入张量形状为 (d_0, d_1, … d_n),则输出形状将为 (d_0 X d_1 … d_(axis-1), d_axis X d_(axis+1) … X dn)。

属性

  • 轴 - INT(默认值为 '1'

    指定在输出的外维中应展平到哪个输入维度(不包括)。axis 的值必须在 [-r, r] 范围内,其中 r 是输入张量的秩。负值表示从后向前计数维度。当 axis = 0 时,输出张量的形状为 (1, (d_0 X d_1 … d_n)),其中输入张量的形状为 (d_0, d_1, … d_n)。

输入

  • 输入 (异构) - T

    秩 >= axis 的张量。

输出

  • 输出 (异构) - T

    一个二维张量,包含输入张量的内容,其中输入维度直到 axis 被展平到输出的外维,其余输入维度被展平到输出的内维。

类型约束

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

    将输入和输出限制为所有张量类型,直至 IRv10。

展平 (Flatten) - 13

版本

  • 名称: 展平 (Flatten) (GitHub)

  • : main

  • 起始版本: 13

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

将输入张量展平为二维矩阵。如果输入张量形状为 (d_0, d_1, … d_n),则输出形状将为 (d_0 X d_1 … d_(axis-1), d_axis X d_(axis+1) … X dn)。

属性

  • 轴 - INT(默认值为 '1'

    指定在输出的外维中应展平到哪个输入维度(不包括)。axis 的值必须在 [-r, r] 范围内,其中 r 是输入张量的秩。负值表示从后向前计数维度。当 axis = 0 时,输出张量的形状为 (1, (d_0 X d_1 … d_n)),其中输入张量的形状为 (d_0, d_1, … d_n)。

输入

  • 输入 (异构) - T

    秩 >= axis 的张量。

输出

  • 输出 (异构) - T

    一个二维张量,包含输入张量的内容,其中输入维度直到 axis 被展平到输出的外维,其余输入维度被展平到输出的内维。

类型约束

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

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

展平 (Flatten) - 11

版本

  • 名称: 展平 (Flatten) (GitHub)

  • : main

  • 起始版本: 11

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

将输入张量展平为二维矩阵。如果输入张量形状为 (d_0, d_1, … d_n),则输出形状将为 (d_0 X d_1 … d_(axis-1), d_axis X d_(axis+1) … X dn)。

属性

  • 轴 - INT(默认值为 '1'

    指定在输出的外维中应展平到哪个输入维度(不包括)。axis 的值必须在 [-r, r] 范围内,其中 r 是输入张量的秩。负值表示从后向前计数维度。当 axis = 0 时,输出张量的形状为 (1, (d_0 X d_1 … d_n)),其中输入张量的形状为 (d_0, d_1, … d_n)。

输入

  • 输入 (异构) - T

    秩 >= axis 的张量。

输出

  • 输出 (异构) - T

    一个二维张量,包含输入张量的内容,其中输入维度直到 axis 被展平到输出的外维,其余输入维度被展平到输出的内维。

类型约束

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

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

展平 (Flatten) - 9

版本

  • 名称: 展平 (Flatten) (GitHub)

  • : main

  • 起始版本: 9

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

将输入张量展平为二维矩阵。如果输入张量形状为 (d_0, d_1, … d_n),则输出形状将为 (d_0 X d_1 … d_(axis-1), d_axis X d_(axis+1) … X dn)。

属性

  • 轴 - INT(默认值为 '1'

    指定在输出的外维中应展平到哪个输入维度(不包括)。axis 的值必须在 [0, R] 范围内,其中 R 是输入张量的秩。当 axis = 0 时,输出张量的形状为 (1, (d_0 X d_1 … d_n)),其中输入张量的形状为 (d_0, d_1, … d_n)。

输入

  • 输入 (异构) - T

    秩 >= axis 的张量。

输出

  • 输出 (异构) - T

    一个二维张量,包含输入张量的内容,其中输入维度直到 axis 被展平到输出的外维,其余输入维度被展平到输出的内维。

类型约束

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

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

展平 (Flatten) - 1

版本

  • 名称: 展平 (Flatten) (GitHub)

  • : main

  • 起始版本: 1

  • 函数: False

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

将输入张量展平为二维矩阵。如果输入张量形状为 (d_0, d_1, … d_n),则输出形状将为 (d_0 X d_1 … d_(axis-1), d_axis X d_(axis+1) … X dn)。

属性

  • 轴 - INT(默认值为 '1'

    指定在输出的外维中应展平到哪个输入维度(不包括)。axis 的值必须在 [0, R] 范围内,其中 R 是输入张量的秩。当 axis = 0 时,输出张量的形状为 (1, (d_0 X d_1 … d_n)),其中输入张量的形状为 (d_0, d_1, … d_n)。

输入

  • 输入 (异构) - T

    秩 >= axis 的张量。

输出

  • 输出 (异构) - T

    一个二维张量,包含输入张量的内容,其中输入维度直到 axis 被展平到输出的外维,其余输入维度被展平到输出的内维。

类型约束

  • T 包含 ( tensor(double), tensor(float), tensor(float16) )

    将输入和输出类型限制为浮点张量。