已关闭
[Requirement|需求建议]:新增circular_pad算子950实现 #3110
renshuojian创建于  9月10日关闭于  9月10日
renshuojian
renshuojian
9月10日 创建

Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.

一、背景信息 (必填)

新增circular_pad算子950实现

二、价值/作用 (必填)

新增circular_pad算子950实现

三、设计方案 (必填)

circular_pad 是一个循环填充(Circular Padding)算子,使用输入张量边界的循环填充方式对输入张量进行填充操作。张量维度开始处的值用于填充末尾,末尾的值用于填充开始。如果应用负填充,则张量的末端会被移除。

该算子兼容 PyTorch 的 nn.CircularPad2d 和 nn.CircularPad3d,底层通过 F.pad(input, pad, mode='circular') 实现。

数学公式(以最后一维 W 为例,padding 为 left 和 right):

正 padding(left > 0, right > 0):
output[i] = input[(i - left) mod input_W] for left <= i < left + input_W
output[i] = input[(i - left) mod input_W] for 0 <= i < left (从末尾绕回)
output[i] = input[(i - left) mod input_W] for left + input_W <= i < output_W (从开头绕回)

负 padding(left < 0, right < 0):
裁剪输入的对应维度:input 裁剪为 input[nLeft : input_W + nRight]

通用公式:
output_W = input_W + left + right
output[i] = input[(i - left) mod input_W] for 0 <= i < output_W

对 H 维度同理(top/bottom),对 D 维度同理(front/back)。

3.1 使能方式(涉及哪些框架:如Aclnn直调、Pytorch训练等)
3.2 总体设计
3.2.1 算子支持的数据类型
3.2.2 host侧设计
3.2.3 kernel侧设计
3.3 支持硬件

3.4 算子约束限制

💡 备注(选填)

likedislike
CANN-robotCANN-robot成员
9月10日 关闭了 issue
CANN-robotCANN-robot成员
9月10日 添加了label:resolved
陈思陈思成员
9月22日 将 rsj007 设为负责人