接口功能:将tensor self进行flatten后,重复Tensor repeats中的相应次数。
示例: 假设input tensor是 ([[a, b], [c, d], [e, f]]),repeats为([1, 2, 2, 1, 1, 1])。 那么最后生成的tensor为 tensor([a, b, b, c, c, d, e, f]),输出tensor的元素个数为8,与repeats中所有元素之和相同 将tensor进行flatten后,input转变为 ([a, b, c, d, e, f])。该tensor与repeats一一对应进行复制,a重复1次、b重复2次、c重复2次,以此类推。
假设input tensor是 ([[a, b], [c, d], [e, f]]),repeats为([2])。 那么最后生成的tensor为 tensor([a, a, b, b, c, c, d, d, e, e, f, f])。 将tensor进行flatten后,input转变为 ([a, b, c, d, e, f])。该tensor中的每个元素复制repeats中的元素次数,也就是每个元素复制2次。 注意:该场景等效于 repeats为(2)。
每个算子分为,必须先调用“aclnnRepeatInterleaveGetWorkspaceSize”接口获取计算所需workspace大小以及包含了算子计算流程的执行器,再调用“aclnnRepeatInterleave”接口执行计算。
[object Object]
[object Object]
- 确定性计算:
- aclnnRepeatInterleave默认确定性实现。
- 输入shape限制:repeats只能为0D/1D tensor。如果为1D tensor,那么repeats的size必须为1或self的元素个数。
- 输入值域限制:repeats tensor中的值必须为自然数。
- 其他限制:outputSize的值必须符合以下计算结果:当repeats中只有一个元素时,outputSize = self的元素个数 * repeats的值。当repeats中有多个值时,outputSize = repeats的值之和。
[object Object]