Description: Repeats the tensor for the number of times specified by repeats after the tensor self is flattened.
Example: Assume that the input tensor is ([[a, b], [c, d], [e, f]]), and the value of repeats is ([1, 2, 2, 1, 1, 1]). The generated tensor is ([a, b, b, c, c, d, e, f]) with eight elements, same as the sum of all elements in repeats. After the tensor is flattened, the input is converted into ([a, b, c, d, e, f]). The tensor is repeated in one-to-one correspondence with repeats. a is repeated once, b is repeated twice, c is repeated twice, and so on.
Assume that the input tensor is ([[a, b], [c, d], [e, f]]), and the value of repeats is ([2]). In this case, the generated tensor is ([a, a, b, b, c, c, d, d, e, e, f, f]). After the tensor is flattened, the input is converted into ([a, b, c, d, e, f]). Each element in the tensor is repeated based on the number of element times specified by repeats, that is, each element is repeated twice. Note: This scenario is equivalent to repeats being (2).
Each operator has calls. First, aclnnRepeatInterleaveGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnRepeatInterleave is called to perform computation.
[object Object][object Object]
Parameters:
self (aclTensor*, compute input): aclTensor on the device, indicating the input tensor to be copied. Empty tensors and are supported. The can be ND, and the shape supports zero to eight dimensions.
- [object Object]Atlas inference series products[object Object] and [object Object]Atlas training series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, or FLOAT.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, BFLOAT16, or FLOAT.
repeats (aclTensor*, compute input): aclTensor on the device, number of repeats. The data type can be INT32 or INT64. repeats can only be a zero- or one-dimensional tensor. For a one-dimensional tensor, the size of repeats must be 1 or equal to the number of elements of self. Empty tensors and are supported. The can be ND.
outputSize (int64_t, compute input): final size of the tensor after repeats. int64_t type on the host. If repeats contains only one element, outputSize = Number of elements of self × Value of repeats. If repeats contains multiple values, outputSize = Sum of repeats.
out (aclTensor*, compute output): aclTensor on the device, output tensor after data copy is complete. The data type must be the same as that of self. are supported. The can be ND. The shape is a one-dimensional tensor, and must have the same size as outputSize.
- [object Object]Atlas inference series products[object Object] and [object Object]Atlas training series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, or FLOAT.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, BFLOAT16, or FLOAT.
workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.
executor (aclOpExecutor**, output): operator executor, containing the operator computation process.
Returns:
Parameters:
workspace (void*, input): address of the workspace to be allocated on the device.
workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API aclnnRepeatInterleaveGetWorkspaceSize.
executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
stream (aclrtStream, input): stream for executing the task.
Returns:
- Deterministic compute:
- aclnnRepeatInterleave defaults to a deterministic implementation.
The following conditions must be met during computation:
- repeats can only be a zero- or one-dimensional tensor. For a one-dimensional tensor, the size of repeats must be 1 or equal to the number of elements of self. The value in the repeats tensor must be a natural number.
- The value of outputSize must meet the following conditions: If repeats contains only one element, outputSize = Number of elements of self × Value of repeats. If repeats contains multiple values, outputSize = Sum of repeats.
The following example is for reference only. For details, see .