vsplit¶
- paddle. vsplit ( x: Tensor, num_or_indices: int | Sequence[int], name: str | None = None ) list[Tensor] [source]
-
vsplit
Full name Vertical Split, splits the input Tensor into multiple sub-Tensors along the vertical axis, which is equivalent topaddle.tensor_split
withaxis=0
.When the number of Tensor dimensions is equal to 2:
When the number of Tensor dimensions is greater than 2:
Note
Make sure that the number of Tensor dimensions transformed using
paddle.vsplit
must be not less than 2.- Parameters
-
x (Tensor) – A Tensor whose dimension must be greater than 1. The data type is bool, bfloat16, float16, float32, float64, uint8, int32 or int64.
num_or_indices (int|list|tuple) – If
num_or_indices
is an intn
,x
is split inton
sections. Ifnum_or_indices
is a list or tuple of integer indices,x
is split at each of the indices.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
-
list[Tensor], The list of segmented Tensors.
Examples
>>> import paddle >>> # x is a Tensor of shape [8, 6, 7] >>> x = paddle.rand([8, 6, 7]) >>> out0, out1 = paddle.vsplit(x, num_or_indices=2) >>> print(out0.shape) [4, 6, 7] >>> print(out1.shape) [4, 6, 7] >>> out0, out1, out2 = paddle.vsplit(x, num_or_indices=[1, 4]) >>> print(out0.shape) [1, 6, 7] >>> print(out1.shape) [3, 6, 7] >>> print(out2.shape) [4, 6, 7]