RepeatOperation

Applicable Products

Hardware Model

Supported

Remarks

Atlas 350 accelerator cards

x

-

Atlas A3 inference products/Atlas A3 training products

√

-

Atlas A2 training products/Atlas A2 inference products

√

-

Atlas training products

√

-

Atlas inference products

√

-

Atlas 200I/500 A2 inference products

√

The input and output tensors of the bf16 data type are not supported.

Description

Extends the shape of the input tensor by a specified multiple based on the multiples information in the parameter.

Definition

1
2
3
4
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 quantity 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

[x_dim_0, x_dim_1, ..., x_dim_n]

float16/bf16

ND

Input tensor

Output

Parameter

Dimension

Data Type

Format

Description

y

[y_dim_0, y_dim_1, ..., y_dim_n]

float16/bf16

ND

Output tensor. Same as the input data type.

Constraints

  • The number of dimensions of the output y is the same as the number of elements of multiples. The size of each dimension is the product of the number of dimensions of the input x broadcast to the number of elements of 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 after being broadcast based on multiples 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]]]
  • 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]]]