# split¶

`paddle.` `split` ( x, num_or_sections, axis=0, name=None ) [source]

Split the input tensor into multiple sub-Tensors.

Parameters
• x (Tensor) – A N-D Tensor. The data type is bool, float16, float32, float64, int32 or int64.

• num_or_sections (int|list|tuple) – If `num_or_sections` is an int, then `num_or_sections` indicates the number of equal sized sub-Tensors that the `x` will be divided into. If `num_or_sections` is a list or tuple, the length of it indicates the number of sub-Tensors and the elements in it indicate the sizes of sub-Tensors’ dimension orderly. The length of the list must not be larger than the `x` ‘s size of specified `axis`.

• axis (int|Tensor, optional) – The axis along which to split, it can be a scalar with type `int` or a `Tensor` with shape [1] and data type `int32` or `int64`. If :math::axis < 0, the axis to split along is \(rank(x) + axis\). Default is 0.

• name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name .

Returns

The list of segmented Tensors.

Return type

list(Tensor)

Example

```import paddle

# x is a Tensor of shape [3, 9, 5]

out0, out1, out2 = paddle.split(x, num_or_sections=3, axis=1)
print(out0.shape)  # [3, 3, 5]
print(out1.shape)  # [3, 3, 5]
print(out2.shape)  # [3, 3, 5]

out0, out1, out2 = paddle.split(x, num_or_sections=[2, 3, 4], axis=1)
print(out0.shape)  # [3, 2, 5]
print(out1.shape)  # [3, 3, 5]
print(out2.shape)  # [3, 4, 5]

out0, out1, out2 = paddle.split(x, num_or_sections=[2, 3, -1], axis=1)
print(out0.shape)  # [3, 2, 5]
print(out1.shape)  # [3, 3, 5]
print(out2.shape)  # [3, 4, 5]

# axis is negative, the real axis is (rank(x) + axis)=1
out0, out1, out2 = paddle.split(x, num_or_sections=3, axis=-2)
print(out0.shape)  # [3, 3, 5]
print(out1.shape)  # [3, 3, 5]
print(out2.shape)  # [3, 3, 5]
```