Conversion Relationship

When the output aclTensor data type of an API (such as aclnnAdd, aclnnMul, etc.) differs from the data type deduced from the input data type after computation type deduction, the API internally converts the computation result to the data type corresponding to the output type.

Data types that support conversion include:

  • Floating-point types: ACL_FLOAT16, ACL_FLOAT, ACL_DOUBLE, ACL_BF16.
  • Integer types: ACL_INT8, ACL_UINT8, ACL_INT16, ACL_UINT16, ACL_INT32, ACL_UINT32, ACL_INT64, ACL_UINT64.
  • Complex types: ACL_COMPLEX32, ACL_COMPLEX64, ACL_COMPLEX128.

Conversions must meet the following rules. Otherwise, the conversion cannot be performed, and parameter check fails when the API is called.

  • Integer types can be converted among themselves, and conversion to floating-point and complex types is also supported.
  • Floating-point types can be converted to each other, and conversion to integer and complex types is also supported.
  • Complex types can be converted to each other and to floating-point types. ACL_COMPLEX32 currently supports conversion only to ACL_FLOAT16 floating-point type, but not to other types.
  • BOOL supports conversion to integer, floating-point, and complex types.

Conversions in scenarios other than those described above are not supported.