RepeatOperation
Description
Extends the shape of the input tensor by a specified multiple based on the multiples information in the parameter.
Definition
struct RepeatParam {
SVector<int64_t> multiples;
uint8_t rsv[8] = {0};
};
Parameters
Member |
Type |
Default Value |
Description |
|---|---|---|---|
multiples |
SVector<int64_t> |
- |
Extension multiple of each dimension of the input tensor. The input tensor can be broadcast. A maximum of two dimensions can be extended. The dimension of multiples must be less than or equal to 8 and greater than or equal to the dimension of the input tensor. Each element must be greater than 0. |
rsv[8] |
uint8_t |
{0} |
Reserved |
Input
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
x |
[-1,...,-1] The value -1 indicates that the size of the current dimension is not restricted. |
float16/bf16 |
ND |
Input tensor |
Output
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
y |
[-1,...,-1] The value -1 indicates that the size of the current dimension is not restricted. |
float16/bf16 |
ND |
Output tensor. Same as the input data type. |
Restrictions
- The dimension of output y is the same as that of multiples. The size of each dimension is the product of the dimension of input x broadcast to multiples and the corresponding dimension of multiples.
- The shape of the input tensor is greater than 1 and the number of dimensions to be extended plus the number of dimensions of the input tensor must be less than or equal to 8.
Functions
- When the length of multiples is the same as the dimension of the input tensor:
The size of each dimension of the output tensor is the product of the dimension size of the input tensor and the corresponding dimension size of the multiples parameter.
For example, if the shape of the input tensor is [1, 2, 3] and the shape of the multiples parameter is {1, 2, 2}. The shape of the output tensor is [1, 4, 6].
- inTensor:
[[[1,2,3] [4,5,6]]]
After the repeat operation is performed:
- outTensor:
[[[1,2,3,1,2,3], [4,5,6,4,5,6], [1,2,3,1,2,3], [4,5,6,4,5,6]]]
- inTensor:
- When the length of multiples is greater than the dimension of the input tensor:
The size of each dimension of the output tensor is the product of the input tensor dimension and its corresponding dimension after the input tensor dimension is broadcast to the length of the multiples parameter.
For example, if the shape of the input tensor is [2, 3] and the shape of the multiples parameter is {1, 2, 2}. The shape of the output tensor is [1, 4, 6].
- inTensor:
[[1,2,3] [4,5,6]]
After the repeat operation is performed:
- outTensor:
[[[1,2,3,1,2,3], [4,5,6,4,5,6], [1,2,3,1,2,3], [4,5,6,4,5,6]]]
- inTensor: