* ops to rst * fix errors * formula fix * change code * console directive * vsplit try hoghlight * fix code snippets * comment fixes * fix list
2.8 KiB
Split
@sphinxdirective
Versioned name: Split-1
Category: Data movement
Short description: Split operation splits an input tensor into pieces of the same length along some axis.
Detailed Description
Split operation splits a given input tensor data into chunks of the same length along a scalar axis. It produces multiple output tensors based on num_splits attribute.
The i-th output tensor shape is equal to the input tensor data shape, except for dimension along axis which is data.shape[axis]/num_splits.
.. math::
shape_output_tensor = [data.shape[0], data.shape[1], \dotsc , data.shape[axis]/num_splits, \dotsc data.shape[D-1]]
Where D is the rank of input tensor data. The axis being split must be evenly divided by num_splits attribute.
Attributes
-
num_splits
- Description: number of outputs into which the input tensor
datawill be split alongaxisdimension. The dimension ofdatashape alongaxismust be evenly divisible by num_splits - Range of values: an integer within the range
[1, data.shape[axis]] - Type:
int - Required: yes
- Description: number of outputs into which the input tensor
Inputs
- 1:
data. A tensor of type T and arbitrary shape. Required. - 2:
axis. Axis alongdatato split. A scalar of type T_AXIS within the range[-rank(data), rank(data) - 1]. Negative values address dimensions from the end. Required. - Note: The dimension of input tensor
datashape alongaxismust be evenly divisible by num_splits attribute.
Outputs
- Multiple outputs: Tensors of type T. The i-th output has the same shape as
datainput tensor except for dimension alongaxiswhich isdata.shape[axis]/num_splits.
Types
- T: any arbitrary supported type.
- T_AXIS: any integer type.
Example
.. code-block:: cpp
<layer id="1" type="Split" ...>
<data num_splits="3" />
<input>
<port id="0"> < !-- some data -->
<dim>6</dim>
<dim>12</dim>
<dim>10</dim>
<dim>24</dim>
</port>
<port id="1"> < !-- axis: 1 -->
</port>
</input>
<output>
<port id="2">
<dim>6</dim>
<dim>4</dim>
<dim>10</dim>
<dim>24</dim>
</port>
<port id="3">
<dim>6</dim>
<dim>4</dim>
<dim>10</dim>
<dim>24</dim>
</port>
<port id="4">
<dim>6</dim>
<dim>4</dim>
<dim>10</dim>
<dim>24</dim>
</port>
</output>
</layer>
@endsphinxdirective