Versioned name : Convert-1

Category : Type conversion

Short description : Convert operation performs element-wise conversion on a given input tensor to a type specified in the destination_type attribute.

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. The result of unsupported conversions is undefined, e.g. conversion of negative signed integer value to any unsigned integer type.

Output elements are represented as follows:

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

where a corresponds to the input tensor.

Attributes :

  • 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 and arbitrary shape. Required.


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


  • T : any supported type


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