oneflow.hsplit¶
-
oneflow.
hsplit
(input, indices_or_sections) → List of Tensors¶ The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.hsplit.html.
Splits input, a tensor with one or more dimensions, into multiple tensors horizontally according to indices_or_sections. Each split is a view of input.
If input is one dimensional this is equivalent to calling oneflow.tensor_split(input, indices_or_sections, dim=0) (the split dimension is zero), and if input has two or more dimensions it’s equivalent to calling oneflow.tensor_split(input, indices_or_sections, dim=1) (the split dimension is 1), except that if indices_or_sections is an integer it must evenly divide the split dimension or a runtime error will be thrown.
- Parameters
input (Tensor) – the input tensor.
indices_or_sections (int or a list) – See argument in
oneflow.tensor_split()
.
- Returns
the output TensorTuple.
- Return type
oneflow.TensorTuple
For example:
>>> import oneflow as flow >>> input = flow.rand(3,4,5,6) >>> output = flow.hsplit(input,(1,3)) >>> output[0].size() oneflow.Size([3, 1, 5, 6]) >>> output[1].size() oneflow.Size([3, 2, 5, 6]) >>> output[2].size() oneflow.Size([3, 1, 5, 6])