Convert op specification refactoring. (#5530)

* Convert op specification refactoring.

* Minor readability improvements.

* Fixed 'category' formatting.
This commit is contained in:
Jozef Daniecki 2021-05-06 16:16:52 +02:00 committed by GitHub
parent b3c1dd9de3
commit 2896b3af8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,9 +2,18 @@
**Versioned name**: *Convert-1*
**Category**: type conversion
**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. convertion of negative signed integer value to any unsigned integer type.
\f[
o_{i} = convert(a_{i})
\f]
**Short description**: Operation converts all elements of the input tensor to a type specified in the *"destination_type"* attribute.
**Attributes**:
@ -12,29 +21,21 @@
* **Description**: the destination type
* **Range of values**: one of the supported types *T*
* **Type**: string
* **Type**: `string`
* **Default value**: None
* **Required**: *Yes*
**Inputs**
* **1**: A tensor of type T. **Required.**
* **1**: A tensor of type *T* and arbitrary shape. **Required.**
**Outputs**
* **1**: The result of element-wise *"Convert"* operation. A tensor of *"destination_type"* type and the same shape with input tensor.
* **1**: The result of element-wise *Convert* operation. A tensor of *destination_type* type and the same shape as input tensor.
**Types**
* *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*.
\f[
o_{i} = convert(a_{i})
\f]
* *T*: `u8`, `u16`, `u32`, `u64`, `i8`, `i16`, `i32`, `i64`, `f16`, `f32`, `boolean`, `bf16`
**Examples**