Cast - version 1#

This page documents version 1 of operator Cast. See Cast for the latest version (since version 25).

  • Domain: ai.onnx

  • Since version: 1

The operator casts the elements of a given input tensor to a data type specified by the ‘to’ argument and returns an output tensor of the same size in the converted type. The ‘to’ argument must be one of the data types specified in the ‘DataType’ enum field in the TensorProto message. NOTE: Casting to and from strings is not supported yet.

Inputs

  • input (T1): Input tensor to be cast.

Outputs

  • output (T2): Output tensor with the same shape as input with type specified by the ‘to’ argument

Type Constraints

  • T1: Constrain input types. Casting from strings and complex are not supported. Allowed types: tensor(bool), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8).

  • T2: Constrain output types. Casting to strings and complex are not supported. Allowed types: tensor(bool), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8).