Split - version 13#

This page documents version 13 of operator Split. See Split for the latest version (since version 18).

  • Domain: ai.onnx

  • Since version: 13

Split a tensor into a list of tensors, along the specified ‘axis’. Lengths of the parts can be specified using input ‘split’. Otherwise, the tensor is split to equal sized parts.

Inputs

  • input (T): The tensor to split

  • split (tensor(int64)): Optional length of each output. Values should be >= 0.Sum of the values must be equal to the dim value at ‘axis’ specified.

Outputs

Between 1 and ∞ outputs.

  • outputs (T): One or more outputs forming list of tensors after splitting

Attributes

  • axis (int): Which axis to split on. A negative value means counting dimensions from the back. Accepted range is [-rank, rank-1] where r = rank(input).

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(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8).

Examples#

test_cc_split_equal_parts_1d_opset13

Node:
  Split(input) -> (output_1, output_2, output_3)
  Attributes:
    axis = 0
Inputs:
  input: shape=(6,), dtype=float32
    [1., 2., 3., 4., 5., 6.]

Outputs:
  output_1: shape=(2,), dtype=float32
    [1., 2.]
  output_2: shape=(2,), dtype=float32
    [3., 4.]
  output_3: shape=(2,), dtype=float32
    [5., 6.]

test_cc_split_equal_parts_2d_opset13

Node:
  Split(input) -> (output_1, output_2)
  Attributes:
    axis = 1
Inputs:
  input: shape=(2, 6), dtype=float32
    [[ 1.,  2.,  3.,  4.,  5.,  6.],
     [ 7.,  8.,  9., 10., 11., 12.]]

Outputs:
  output_1: shape=(2, 3), dtype=float32
    [[1., 2., 3.],
     [7., 8., 9.]]
  output_2: shape=(2, 3), dtype=float32
    [[ 4.,  5.,  6.],
     [10., 11., 12.]]

test_cc_split_equal_parts_default_axis_opset13

Node:
  Split(input) -> (output_1, output_2, output_3)
Inputs:
  input: shape=(6,), dtype=float32
    [1., 2., 3., 4., 5., 6.]

Outputs:
  output_1: shape=(2,), dtype=float32
    [1., 2.]
  output_2: shape=(2,), dtype=float32
    [3., 4.]
  output_3: shape=(2,), dtype=float32
    [5., 6.]

test_cc_split_variable_parts_1d_opset13

Node:
  Split(input, split) -> (output_1, output_2)
  Attributes:
    axis = 0
Inputs:
  input: shape=(6,), dtype=float32
    [1., 2., 3., 4., 5., 6.]
  split: shape=(2,), dtype=int64
    [2, 4]

Outputs:
  output_1: shape=(2,), dtype=float32
    [1., 2.]
  output_2: shape=(4,), dtype=float32
    [3., 4., 5., 6.]

test_cc_split_variable_parts_2d_opset13

Node:
  Split(input, split) -> (output_1, output_2)
  Attributes:
    axis = 1
Inputs:
  input: shape=(2, 6), dtype=float32
    [[ 1.,  2.,  3.,  4.,  5.,  6.],
     [ 7.,  8.,  9., 10., 11., 12.]]
  split: shape=(2,), dtype=int64
    [2, 4]

Outputs:
  output_1: shape=(2, 2), dtype=float32
    [[1., 2.],
     [7., 8.]]
  output_2: shape=(2, 4), dtype=float32
    [[ 3.,  4.,  5.,  6.],
     [ 9., 10., 11., 12.]]

test_cc_split_variable_parts_default_axis_opset13

Node:
  Split(input, split) -> (output_1, output_2)
Inputs:
  input: shape=(6,), dtype=float32
    [1., 2., 3., 4., 5., 6.]
  split: shape=(2,), dtype=int64
    [2, 4]

Outputs:
  output_1: shape=(2,), dtype=float32
    [1., 2.]
  output_2: shape=(4,), dtype=float32
    [3., 4., 5., 6.]

test_cc_split_zero_size_splits_opset13

Node:
  Split(input, split) -> (output_1, output_2, output_3)
Inputs:
  input: shape=(0,), dtype=float32
    []
  split: shape=(3,), dtype=int64
    [0, 0, 0]

Outputs:
  output_1: shape=(0,), dtype=float32
    []
  output_2: shape=(0,), dtype=float32
    []
  output_3: shape=(0,), dtype=float32
    []

Differences with previous version (11)#

SchemaDiff: Split (domain 'ai.onnx')

  • old version: 11

  • new version: 13

  • breaking: yes

Breaking reasons:

  • input ‘split’ (added): at position 1; option=Single; type_str=’tensor(int64)’

  • attribute ‘split’ (removed): type=INTS; required=False

Inputs:

  • [BREAKING] added ‘split’: at position 1; option=Single; type_str=’tensor(int64)’

Attributes:

  • [BREAKING] removed ‘split’: type=INTS; required=False

Type constraints:

  • changed ‘T’: added types: [‘tensor(bfloat16)’]

Documentation:

  • line similarity: 0.67 (+1/-1 lines)

--- Split v11
+++ Split v13
@@ -1,3 +1,3 @@
 Split a tensor into a list of tensors, along the specified
-'axis'. Lengths of the parts can be specified using argument 'split'.
+'axis'. Lengths of the parts can be specified using input 'split'.
 Otherwise, the tensor is split to equal sized parts.