Reshape#

  • Domain: ai.onnx

  • Since version: 25

Reshape the input tensor similar to numpy.reshape.

Inputs

  • data (T): An input tensor.

  • shape (tensor(int64)): Specified shape for output.

Outputs

  • reshaped (T): Reshaped data.

Attributes

  • allowzero (int): (Optional) By default, when any value in the ‘shape’ input is equal to zero the corresponding dimension value is copied from the input tensor dynamically. allowzero=1 indicates that if any value in the ‘shape’ input is set to zero, the zero value is honored, similar to NumPy.

Type Constraints

  • T: Constrain input and output types to all tensor types. Allowed types: tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(float4e2m1), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(float8e8m0), tensor(int16), tensor(int2), tensor(int32), tensor(int4), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint2), tensor(uint32), tensor(uint4), tensor(uint64), tensor(uint8).

Differences with previous version (13)#

SchemaDiff: Reshape (domain 'ai.onnx')

  • old version: 13

  • new version: 25

  • breaking: no

Attributes:

  • added ‘allowzero’: type=INT; required=False; default=0

Type constraints:

  • changed ‘T’: added types: [‘tensor(float4e2m1)’, ‘tensor(float8e4m3fn)’, ‘tensor(float8e4m3fnuz)’, ‘tensor(float8e5m2)’, ‘tensor(float8e5m2fnuz)’, ‘tensor(float8e8m0)’, ‘tensor(int2)’, ‘tensor(int4)’, ‘tensor(uint2)’, ‘tensor(uint4)’]

Version History#