Versioned name: Convert-1

Category: type conversion

Short description: Operation converts all elements of the input tensor to a type specified in the *"destination_type"* attribute.


  • destination_type
    • Description: the destination type
    • Range of values: one of the supported types T
    • Type: string
    • Default value: None
    • Required: Yes


  • 1: A tensor of type T. Required.


  • 1: The result of element-wise *"Convert"* operation. A tensor of *"destination_type"* type and the same shape with input tensor.


  • T: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, boolean, bf16

Detailed description

Conversion from one supported type to another supported type is always allowed. User must be aware of precision loss and value change caused by range difference between two types. For example, a 32-bit float 3.141592 may be round to a 32-bit int 3.

\[ o_{i} = convert(a_{i}) \]


Example 1

<layer ... type="Convert">
<data destination_type="f32"/>
<port id="0"> <!-- type: i32 -->
<port id="1"> <!-- result type: f32 -->