CastLike

CastLike - 24

版本

  • 名称CastLike (GitHub)

  • : main

  • 起始版本24

  • 函数: True

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

该操作符将给定输入张量(第一个输入)的元素转换为与第二个输入张量元素相同的数据类型。更多详情请参阅 Cast 操作符的文档。

属性

  • round_mode - 字符串(默认值为 'up'

    转换为 float8e8m0 的舍入模式。它仅适用于转换为 float8e8m0,默认值为 upup:向远离零的最近值舍入,down:向靠近零的最近值舍入,nearest:向最近值舍入,并向上舍入。更多详情请参阅 Cast 操作符的描述。

  • saturate - 整型 (默认为 '1')

    此参数定义了当输入值超出目标类型范围时转换的行为。它仅适用于 float 8 转换 (float8e4m3fn, float8e4m3fnuz, float8e5m2, float8e5m2fnuz, float8e8m0)。默认值为 true。更多详情请参阅 Cast 操作符的描述。

输入

  • input (异构) - T1

    要转换的输入张量。

  • target_type (异构) - T2

    第一个输入张量将被转换以生成与此(第二个输入)张量类型相同的张量。

输出

  • output (异构) - T2

    通过将第一个输入张量转换为与第二个输入张量相同类型而产生的输出张量。

类型约束

  • T1 包含 ( tensor(bfloat16), tensor(bool), 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) )

    限制输入类型。不支持从复数进行转换。

  • T2 包含 ( tensor(bfloat16), tensor(bool), 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) )

    限制输出类型。不支持转换为复数。

CastLike - 23

版本

  • 名称CastLike (GitHub)

  • : main

  • 起始版本23

  • 函数: True

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

该操作符将给定输入张量(第一个输入)的元素转换为与第二个输入张量元素相同的数据类型。更多详情请参阅 Cast 操作符的文档。

属性

  • saturate - 整型 (默认为 '1')

    此参数定义了当输入值超出目标类型范围时转换的行为。它仅适用于 float 8 转换 (float8e4m3fn, float8e4m3fnuz, float8e5m2, float8e5m2fnuz)。默认值为 true。更多详情请参阅 Cast 操作符的描述。

输入

  • input (异构) - T1

    要转换的输入张量。

  • target_type (异构) - T2

    第一个输入张量将被转换以生成与此(第二个输入)张量类型相同的张量。

输出

  • output (异构) - T2

    通过将第一个输入张量转换为与第二个输入张量相同类型而产生的输出张量。

类型约束

  • T1 包含 ( tensor(bfloat16), tensor(bool), 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) )

    限制输入类型。不支持从复数进行转换。

  • T2 包含 ( tensor(bfloat16), tensor(bool), 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) )

    限制输出类型。不支持转换为复数。

CastLike - 21

版本

  • 名称CastLike (GitHub)

  • : main

  • since_version: 21

  • 函数: True

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

该操作符将给定输入张量(第一个输入)的元素转换为与第二个输入张量元素相同的数据类型。更多详情请参阅 Cast 操作符的文档。

属性

  • saturate - 整型 (默认为 '1')

    此参数定义了当输入值超出目标类型范围时转换的行为。它仅适用于 float 8 转换 (float8e4m3fn, float8e4m3fnuz, float8e5m2, float8e5m2fnuz)。默认值为 true。更多详情请参阅 Cast 操作符的描述。

输入

  • input (异构) - T1

    要转换的输入张量。

  • target_type (异构) - T2

    第一个输入张量将被转换以生成与此(第二个输入)张量类型相同的张量。

输出

  • output (异构) - T2

    通过将第一个输入张量转换为与第二个输入张量相同类型而产生的输出张量。

类型约束

  • T1 包含 ( tensor(bfloat16), tensor(bool), 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) )

    限制输入类型。不支持从复数进行转换。

  • T2 包含 ( tensor(bfloat16), tensor(bool), 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) )

    限制输出类型。不支持转换为复数。

CastLike - 19

版本

  • 名称CastLike (GitHub)

  • : main

  • since_version: 19

  • 函数: True

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

该操作符将给定输入张量(第一个输入)的元素转换为与第二个输入张量元素相同的数据类型。更多详情请参阅 Cast 操作符的文档。

属性

  • saturate - 整型 (默认为 '1')

    此参数定义了当输入值超出目标类型范围时转换的行为。它仅适用于 float 8 转换 (float8e4m3fn, float8e4m3fnuz, float8e5m2, float8e5m2fnuz)。默认值为 true。更多详情请参阅 Cast 操作符的描述。

输入

  • input (异构) - T1

    要转换的输入张量。

  • target_type (异构) - T2

    第一个输入张量将被转换以生成与此(第二个输入)张量类型相同的张量。

输出

  • output (异构) - T2

    通过将第一个输入张量转换为与第二个输入张量相同类型而产生的输出张量。

类型约束

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

    限制输入类型。不支持从复数进行转换。

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

    限制输出类型。不支持转换为复数。

CastLike - 15

版本

  • 名称CastLike (GitHub)

  • : main

  • 起始版本: 15

  • 函数: True

  • 支持级别: SupportType.COMMON

  • 形状推断: True

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

摘要

该操作符将给定输入张量(第一个输入)的元素转换为与第二个输入张量元素相同的数据类型。更多详情请参阅 Cast 操作符的文档。

输入

  • input (异构) - T1

    要转换的输入张量。

  • target_type (异构) - T2

    第一个输入张量将被转换以生成与此(第二个输入)张量类型相同的张量。

输出

  • output (异构) - T2

    通过将第一个输入张量转换为与第二个输入张量相同类型而产生的输出张量。

类型约束

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

    限制输入类型。不支持从复数进行转换。

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

    限制输出类型。不支持转换为复数。