Reshape

Reshape - 21

Version

  • name: Reshape (GitHub)

  • domain: main

  • since_version: 21

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 21.

Summary

Reshape the input tensor similar to numpy.reshape. First input is the data tensor, second input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. At most one dimension of the new shape can be -1. In this case, the value is inferred from the size of the tensor and the remaining dimensions. A dimension could also be 0, in which case the actual dimension value is unchanged (i.e. taken from the input tensor). If ‘allowzero’ is set, and the new shape includes 0, the dimension will be set explicitly to zero (i.e. not taken from input tensor). Shape (second input) could be an empty shape, which means converting to a scalar. The input tensor’s shape and the output tensor’s shape are required to have the same number of elements.

If the attribute ‘allowzero’ is set, it is invalid for the specified shape to contain both a zero value and -1, as the value of the dimension corresponding to -1 cannot be determined uniquely.

Attributes

  • allowzero - INT (default is '0'):

    (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.

Inputs

  • data (heterogeneous) - T:

    An input tensor.

  • shape (heterogeneous) - tensor(int64):

    Specified shape for output.

Outputs

  • reshaped (heterogeneous) - T:

    Reshaped data.

Type Constraints

  • T in ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int16), tensor(int32), tensor(int4), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint4), tensor(uint64), tensor(uint8) ):

    Constrain input and output types to all tensor types.

Reshape - 19

Version

  • name: Reshape (GitHub)

  • domain: main

  • since_version: 19

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 19.

Summary

Reshape the input tensor similar to numpy.reshape. First input is the data tensor, second input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. At most one dimension of the new shape can be -1. In this case, the value is inferred from the size of the tensor and the remaining dimensions. A dimension could also be 0, in which case the actual dimension value is unchanged (i.e. taken from the input tensor). If ‘allowzero’ is set, and the new shape includes 0, the dimension will be set explicitly to zero (i.e. not taken from input tensor). Shape (second input) could be an empty shape, which means converting to a scalar. The input tensor’s shape and the output tensor’s shape are required to have the same number of elements.

If the attribute ‘allowzero’ is set, it is invalid for the specified shape to contain both a zero value and -1, as the value of the dimension corresponding to -1 cannot be determined uniquely.

Attributes

  • allowzero - INT (default is '0'):

    (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.

Inputs

  • data (heterogeneous) - T:

    An input tensor.

  • shape (heterogeneous) - tensor(int64):

    Specified shape for output.

Outputs

  • reshaped (heterogeneous) - T:

    Reshaped data.

Type Constraints

  • T in ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(float8e4m3fn), tensor(float8e4m3fnuz), tensor(float8e5m2), tensor(float8e5m2fnuz), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ):

    Constrain input and output types to all tensor types.

Reshape - 14

Version

  • name: Reshape (GitHub)

  • domain: main

  • since_version: 14

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 14.

Summary

Reshape the input tensor similar to numpy.reshape. First input is the data tensor, second input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. At most one dimension of the new shape can be -1. In this case, the value is inferred from the size of the tensor and the remaining dimensions. A dimension could also be 0, in which case the actual dimension value is unchanged (i.e. taken from the input tensor). If ‘allowzero’ is set, and the new shape includes 0, the dimension will be set explicitly to zero (i.e. not taken from input tensor). Shape (second input) could be an empty shape, which means converting to a scalar. The input tensor’s shape and the output tensor’s shape are required to have the same number of elements.

If the attribute ‘allowzero’ is set, it is invalid for the specified shape to contain both a zero value and -1, as the value of the dimension corresponding to -1 cannot be determined uniquely.

Attributes

  • allowzero - INT (default is '0'):

    (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.

Inputs

  • data (heterogeneous) - T:

    An input tensor.

  • shape (heterogeneous) - tensor(int64):

    Specified shape for output.

Outputs

  • reshaped (heterogeneous) - T:

    Reshaped data.

Type Constraints

  • T in ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ):

    Constrain input and output types to all tensor types.

Reshape - 13

Version

  • name: Reshape (GitHub)

  • domain: main

  • since_version: 13

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 13.

Summary

Reshape the input tensor similar to numpy.reshape. First input is the data tensor, second input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. At most one dimension of the new shape can be -1. In this case, the value is inferred from the size of the tensor and the remaining dimensions. A dimension could also be 0, in which case the actual dimension value is unchanged (i.e. taken from the input tensor). Shape (second input) could be an empty shape, which means converting to a scalar. The input tensor’s shape and the output tensor’s shape are required to have the same number of elements.

Inputs

  • data (heterogeneous) - T:

    An input tensor.

  • shape (heterogeneous) - tensor(int64):

    Specified shape for output.

Outputs

  • reshaped (heterogeneous) - T:

    Reshaped data.

Type Constraints

  • T in ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ):

    Constrain input and output types to all tensor types.

Reshape - 5

Version

  • name: Reshape (GitHub)

  • domain: main

  • since_version: 5

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 5.

Summary

Reshape the input tensor similar to numpy.reshape. First input is the data tensor, second input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. At most one dimension of the new shape can be -1. In this case, the value is inferred from the size of the tensor and the remaining dimensions. A dimension could also be 0, in which case the actual dimension value is unchanged (i.e. taken from the input tensor). Shape (second input) could be an empty shape, which means converting to a scalar. The input tensor’s shape and the output tensor’s shape are required to have the same number of elements.

Inputs

  • data (heterogeneous) - T:

    An input tensor.

  • shape (heterogeneous) - tensor(int64):

    Specified shape for output.

Outputs

  • reshaped (heterogeneous) - T:

    Reshaped data.

Type Constraints

  • T in ( tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ):

    Constrain input and output types to all tensor types.

Reshape - 1

Version

  • name: Reshape (GitHub)

  • domain: main

  • since_version: 1

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: False

This version of the operator has been available since version 1.

Summary

Reshape the input tensor similar to numpy.reshape. It takes a tensor as input and an argument shape. It outputs the reshaped tensor. At most one dimension of the new shape can be -1. In this case, the value is inferred from the size of the tensor and the remaining dimensions. A dimension could also be 0, in which case the actual dimension value is unchanged (i.e. taken from the input tensor). Shape (second input) could be an empty shape, which means converting to a scalar. The input tensor’s shape and the output tensor’s shape are required to have the same number of elements.

Attributes

  • consumed_inputs - INTS :

    legacy optimization attribute.

  • shape - INTS :

    New shape

Inputs

  • data (heterogeneous) - T:

    An input tensor.

Outputs

  • reshaped (heterogeneous) - T:

    Reshaped data.

Type Constraints

  • T in ( tensor(double), tensor(float), tensor(float16) ):

    Constrain input and output types to float tensors.