.. _l-onnx-doc-Identity: ======== Identity ======== .. contents:: :local: .. _l-onnx-op-identity-16: Identity - 16 ============= **Version** * **name**: `Identity (GitHub) `_ * **domain**: **main** * **since_version**: **16** * **function**: False * **support_level**: SupportType.COMMON * **shape inference**: True This version of the operator has been available **since version 16**. **Summary** Identity operator **Inputs** * **input** (heterogeneous) - **V**: Input tensor **Outputs** * **output** (heterogeneous) - **V**: Tensor to copy input into. **Type Constraints** * **V** in ( optional(seq(tensor(bool))), optional(seq(tensor(complex128))), optional(seq(tensor(complex64))), optional(seq(tensor(double))), optional(seq(tensor(float))), optional(seq(tensor(float16))), optional(seq(tensor(int16))), optional(seq(tensor(int32))), optional(seq(tensor(int64))), optional(seq(tensor(int8))), optional(seq(tensor(string))), optional(seq(tensor(uint16))), optional(seq(tensor(uint32))), optional(seq(tensor(uint64))), optional(seq(tensor(uint8))), optional(tensor(bool)), optional(tensor(complex128)), optional(tensor(complex64)), optional(tensor(double)), optional(tensor(float)), optional(tensor(float16)), optional(tensor(int16)), optional(tensor(int32)), optional(tensor(int64)), optional(tensor(int8)), optional(tensor(string)), optional(tensor(uint16)), optional(tensor(uint32)), optional(tensor(uint64)), optional(tensor(uint8)), seq(tensor(bool)), seq(tensor(complex128)), seq(tensor(complex64)), seq(tensor(double)), seq(tensor(float)), seq(tensor(float16)), seq(tensor(int16)), seq(tensor(int32)), seq(tensor(int64)), seq(tensor(int8)), seq(tensor(string)), seq(tensor(uint16)), seq(tensor(uint32)), seq(tensor(uint64)), seq(tensor(uint8)), 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, sequence, and optional types. **Examples** **default** :: node = onnx.helper.make_node( "Identity", inputs=["x"], outputs=["y"], ) data = np.array( [ [ [ [1, 2], [3, 4], ] ] ], dtype=np.float32, ) expect(node, inputs=[data], outputs=[data], name="test_identity") **_sequence** :: node = onnx.helper.make_node( "Identity", inputs=["x"], outputs=["y"], ) data = [ np.array( [ [ [ [1, 2], [3, 4], ] ] ], dtype=np.float32, ), np.array( [ [ [ [2, 3], [1, 5], ] ] ], dtype=np.float32, ), ] expect(node, inputs=[data], outputs=[data], name="test_identity_sequence") **_identity_opt** :: ten_in_tp = onnx.helper.make_tensor_type_proto( onnx.TensorProto.FLOAT, shape=[5] ) seq_in_tp = onnx.helper.make_sequence_type_proto(ten_in_tp) opt_in_tp = onnx.helper.make_optional_type_proto(seq_in_tp) identity_node = onnx.helper.make_node( "Identity", inputs=["opt_in"], outputs=["opt_out"] ) x = [np.array([1, 2, 3, 4, 5]).astype(np.float32)] expect( identity_node, inputs=[x], outputs=[x], name="test_identity_opt", opset_imports=[onnx.helper.make_opsetid("", 16)], input_type_protos=[opt_in_tp], output_type_protos=[opt_in_tp], ) **Differences** .. raw:: html
00Identity operatorIdentity operator
11
22**Inputs****Inputs**
33
44* **input** (heterogeneous) - **V**:* **input** (heterogeneous) - **V**:
55 Input tensor Input tensor
66
77**Outputs****Outputs**
88
99* **output** (heterogeneous) - **V**:* **output** (heterogeneous) - **V**:
1010 Tensor to copy input into. Tensor to copy input into.
1111
1212**Type Constraints****Type Constraints**
1313
1414* **V** in (* **V** in (
15 optional(seq(tensor(bool))),
16 optional(seq(tensor(complex128))),
17 optional(seq(tensor(complex64))),
18 optional(seq(tensor(double))),
19 optional(seq(tensor(float))),
20 optional(seq(tensor(float16))),
21 optional(seq(tensor(int16))),
22 optional(seq(tensor(int32))),
23 optional(seq(tensor(int64))),
24 optional(seq(tensor(int8))),
25 optional(seq(tensor(string))),
26 optional(seq(tensor(uint16))),
27 optional(seq(tensor(uint32))),
28 optional(seq(tensor(uint64))),
29 optional(seq(tensor(uint8))),
30 optional(tensor(bool)),
31 optional(tensor(complex128)),
32 optional(tensor(complex64)),
33 optional(tensor(double)),
34 optional(tensor(float)),
35 optional(tensor(float16)),
36 optional(tensor(int16)),
37 optional(tensor(int32)),
38 optional(tensor(int64)),
39 optional(tensor(int8)),
40 optional(tensor(string)),
41 optional(tensor(uint16)),
42 optional(tensor(uint32)),
43 optional(tensor(uint64)),
44 optional(tensor(uint8)),
1545 seq(tensor(bool)), seq(tensor(bool)),
1646 seq(tensor(complex128)), seq(tensor(complex128)),
1747 seq(tensor(complex64)), seq(tensor(complex64)),
1848 seq(tensor(double)), seq(tensor(double)),
1949 seq(tensor(float)), seq(tensor(float)),
2050 seq(tensor(float16)), seq(tensor(float16)),
2151 seq(tensor(int16)), seq(tensor(int16)),
2252 seq(tensor(int32)), seq(tensor(int32)),
2353 seq(tensor(int64)), seq(tensor(int64)),
2454 seq(tensor(int8)), seq(tensor(int8)),
2555 seq(tensor(string)), seq(tensor(string)),
2656 seq(tensor(uint16)), seq(tensor(uint16)),
2757 seq(tensor(uint32)), seq(tensor(uint32)),
2858 seq(tensor(uint64)), seq(tensor(uint64)),
2959 seq(tensor(uint8)), seq(tensor(uint8)),
3060 tensor(bfloat16), tensor(bfloat16),
3161 tensor(bool), tensor(bool),
3262 tensor(complex128), tensor(complex128),
3363 tensor(complex64), tensor(complex64),
3464 tensor(double), tensor(double),
3565 tensor(float), tensor(float),
3666 tensor(float16), tensor(float16),
3767 tensor(int16), tensor(int16),
3868 tensor(int32), tensor(int32),
3969 tensor(int64), tensor(int64),
4070 tensor(int8), tensor(int8),
4171 tensor(string), tensor(string),
4272 tensor(uint16), tensor(uint16),
4373 tensor(uint32), tensor(uint32),
4474 tensor(uint64), tensor(uint64),
4575 tensor(uint8) tensor(uint8)
4676 ): ):
4777 Constrain input and output types to all tensor and sequence types. Constrain input and output types to all tensor, sequence, and
78 optional types.
.. _l-onnx-op-identity-14: Identity - 14 ============= **Version** * **name**: `Identity (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** Identity operator **Inputs** * **input** (heterogeneous) - **V**: Input tensor **Outputs** * **output** (heterogeneous) - **V**: Tensor to copy input into. **Type Constraints** * **V** in ( seq(tensor(bool)), seq(tensor(complex128)), seq(tensor(complex64)), seq(tensor(double)), seq(tensor(float)), seq(tensor(float16)), seq(tensor(int16)), seq(tensor(int32)), seq(tensor(int64)), seq(tensor(int8)), seq(tensor(string)), seq(tensor(uint16)), seq(tensor(uint32)), seq(tensor(uint64)), seq(tensor(uint8)), 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 and sequence types. **Differences** .. raw:: html
00Identity operatorIdentity operator
11
22**Inputs****Inputs**
33
44* **input** (heterogeneous) - **T**:* **input** (heterogeneous) - **V**:
55 Input tensor Input tensor
66
77**Outputs****Outputs**
88
99* **output** (heterogeneous) - **T**:* **output** (heterogeneous) - **V**:
1010 Tensor to copy input into. Tensor to copy input into.
1111
1212**Type Constraints****Type Constraints**
1313
1414* **T** in (* **V** in (
15 seq(tensor(bool)),
16 seq(tensor(complex128)),
17 seq(tensor(complex64)),
18 seq(tensor(double)),
19 seq(tensor(float)),
20 seq(tensor(float16)),
21 seq(tensor(int16)),
22 seq(tensor(int32)),
23 seq(tensor(int64)),
24 seq(tensor(int8)),
25 seq(tensor(string)),
26 seq(tensor(uint16)),
27 seq(tensor(uint32)),
28 seq(tensor(uint64)),
29 seq(tensor(uint8)),
1530 tensor(bfloat16), tensor(bfloat16),
1631 tensor(bool), tensor(bool),
1732 tensor(complex128), tensor(complex128),
1833 tensor(complex64), tensor(complex64),
1934 tensor(double), tensor(double),
2035 tensor(float), tensor(float),
2136 tensor(float16), tensor(float16),
2237 tensor(int16), tensor(int16),
2338 tensor(int32), tensor(int32),
2439 tensor(int64), tensor(int64),
2540 tensor(int8), tensor(int8),
2641 tensor(string), tensor(string),
2742 tensor(uint16), tensor(uint16),
2843 tensor(uint32), tensor(uint32),
2944 tensor(uint64), tensor(uint64),
3045 tensor(uint8) tensor(uint8)
3146 ): ):
3247 Constrain input and output types to all tensor types. Constrain input and output types to all tensor and sequence types.
.. _l-onnx-op-identity-13: Identity - 13 ============= **Version** * **name**: `Identity (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** Identity operator **Inputs** * **input** (heterogeneous) - **T**: Input tensor **Outputs** * **output** (heterogeneous) - **T**: Tensor to copy input into. **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. **Differences** .. raw:: html
00Identity operatorIdentity operator
11
22**Inputs****Inputs**
33
44* **input** (heterogeneous) - **T**:* **input** (heterogeneous) - **T**:
55 Input tensor Input tensor
66
77**Outputs****Outputs**
88
99* **output** (heterogeneous) - **T**:* **output** (heterogeneous) - **T**:
1010 Tensor to copy input into. Tensor to copy input into.
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 Constrain input and output types to all tensor types. Constrain input and output types to all tensor types.
.. _l-onnx-op-identity-1: Identity - 1 ============ **Version** * **name**: `Identity (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** Identity operator **Inputs** * **input** (heterogeneous) - **T**: Input tensor **Outputs** * **output** (heterogeneous) - **T**: Tensor to copy input into. **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.