Shape#

Shape - 15#

Version

  • name: Shape (GitHub)

  • domain: main

  • since_version: 15

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

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

Summary

Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor. Optional attributes start and end can be used to compute a slice of the input tensor’s shape. If start axis is omitted, the slice starts from axis 0. The end axis, if specified, is exclusive (and the returned value will not include the size of that axis). If the end axis is omitted, the axes upto the last one will be included. Negative axes indicate counting back from the last axis. Note that axes will be clipped to the range [0, r-1], where r is the rank of the input tensor if they are out-of-range (after adding r in the case of negative axis). Thus, specifying any end value > r is equivalent to specifying an end value of r, and specifying any start value < -r is equivalent to specifying a start value of 0.

For example: Input tensor with shape: [2, 3, 4] No attributes specified. Output: [2, 3, 4]

Input tensor with shape: [2, 3, 4] start: -1 Output: [4]

Input tensor with shape: [2, 3, 4] end: -1 Output: [2, 3]

Input tensor with shape: [2, 3, 4] start: 1 end: 2 Output: [3]

Attributes

  • end: (Optional) Ending axis for slicing the shape. Negative value means counting dimensions from the back. If omitted, sizes of all axes upto (including) the last one will be included.

  • start: (Optional) Starting axis for slicing the shape. Default value is 0.Negative value means counting dimensions from the back. Default value is 0.

Inputs

  • data (heterogeneous) - T: An input tensor.

Outputs

  • shape (heterogeneous) - T1: Shape of the input tensor

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) ): Input tensor can be of arbitrary type.

  • T1 in ( tensor(int64) ): Constrain output to int64 tensor.

Examples

Differences

00Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor.Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor.
1Optional attributes start and end can be used to compute a slice of the input tensor's shape.
2If start axis is omitted, the slice starts from axis 0.
3The end axis, if specified, is exclusive (and the returned value will not include the size of that axis).
4If the end axis is omitted, the axes upto the last one will be included.
5Negative axes indicate counting back from the last axis.
6Note that axes will be clipped to the range [0, r-1], where r is the
7rank of the input tensor if they are out-of-range (after adding r in the case of
8negative axis). Thus, specifying any end value > r is equivalent to specifying an end
9value of r, and specifying any start value < -r is equivalent to specifying a start
10value of 0.
111
12For example:
13Input tensor with shape: [2, 3, 4]
14No attributes specified.
15Output: [2, 3, 4]
16
17Input tensor with shape: [2, 3, 4]
18start: -1
19Output: [4]
20
21Input tensor with shape: [2, 3, 4]
22end: -1
23Output: [2, 3]
24
25Input tensor with shape: [2, 3, 4]
26start: 1
27end: 2
28Output: [3]
29
30**Attributes**
31
32* **end**:
33 (Optional) Ending axis for slicing the shape. Negative value means
34 counting dimensions from the back. If omitted, sizes of all axes
35 upto (including) the last one will be included.
36* **start**:
37 (Optional) Starting axis for slicing the shape. Default value is
38 0.Negative value means counting dimensions from the back. Default value is 0.
39
240**Inputs****Inputs**
341
442* **data** (heterogeneous) - **T**:* **data** (heterogeneous) - **T**:
543 An input tensor. An input tensor.
644
745**Outputs****Outputs**
846
947* **shape** (heterogeneous) - **T1**:* **shape** (heterogeneous) - **T1**:
1048 Shape of the input tensor Shape of the input tensor
1149
1250**Type Constraints****Type Constraints**
1351
1452* **T** in (* **T** in (
1553 tensor(bfloat16), tensor(bfloat16),
1654 tensor(bool), tensor(bool),
1755 tensor(complex128), tensor(complex128),
1856 tensor(complex64), tensor(complex64),
1957 tensor(double), tensor(double),
2058 tensor(float), tensor(float),
2159 tensor(float16), tensor(float16),
2260 tensor(int16), tensor(int16),
2361 tensor(int32), tensor(int32),
2462 tensor(int64), tensor(int64),
2563 tensor(int8), tensor(int8),
2664 tensor(string), tensor(string),
2765 tensor(uint16), tensor(uint16),
2866 tensor(uint32), tensor(uint32),
2967 tensor(uint64), tensor(uint64),
3068 tensor(uint8) tensor(uint8)
3169 ): ):
3270 Input tensor can be of arbitrary type. Input tensor can be of arbitrary type.
3371* **T1** in (* **T1** in (
3472 tensor(int64) tensor(int64)
3573 ): ):
3674 Constrain output to int64 tensor. Constrain output to int64 tensor.

Shape - 13#

Version

  • name: Shape (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

Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor.

Inputs

  • data (heterogeneous) - T: An input tensor.

Outputs

  • shape (heterogeneous) - T1: Shape of the input tensor

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) ): Input tensor can be of arbitrary type.

  • T1 in ( tensor(int64) ): Constrain output to int64 tensor.

Differences

00Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor.Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor.
11
22**Inputs****Inputs**
33
44* **data** (heterogeneous) - **T**:* **data** (heterogeneous) - **T**:
55 An input tensor. An input tensor.
66
77**Outputs****Outputs**
88
99* **shape** (heterogeneous) - **T1**:* **shape** (heterogeneous) - **T1**:
1010 Shape of the input tensor Shape of the input tensor
1111
1212**Type Constraints****Type Constraints**
1313
1414* **T** in (* **T** in (
15 tensor(bfloat16),
1516 tensor(bool), tensor(bool),
1617 tensor(complex128), tensor(complex128),
1718 tensor(complex64), tensor(complex64),
1819 tensor(double), tensor(double),
1920 tensor(float), tensor(float),
2021 tensor(float16), tensor(float16),
2122 tensor(int16), tensor(int16),
2223 tensor(int32), tensor(int32),
2324 tensor(int64), tensor(int64),
2425 tensor(int8), tensor(int8),
2526 tensor(string), tensor(string),
2627 tensor(uint16), tensor(uint16),
2728 tensor(uint32), tensor(uint32),
2829 tensor(uint64), tensor(uint64),
2930 tensor(uint8) tensor(uint8)
3031 ): ):
3132 Input tensor can be of arbitrary type. Input tensor can be of arbitrary type.
3233* **T1** in (* **T1** in (
3334 tensor(int64) tensor(int64)
3435 ): ):
3536 Constrain output to int64 tensor. Constrain output to int64 tensor.

Shape - 1#

Version

  • name: Shape (GitHub)

  • domain: main

  • since_version: 1

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

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

Summary

Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor.

Inputs

  • data (heterogeneous) - T: An input tensor.

Outputs

  • shape (heterogeneous) - T1: Shape of the input tensor

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) ): Input tensor can be of arbitrary type.

  • T1 in ( tensor(int64) ): Constrain output to int64 tensor.