Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.
增加 Dilation2DBackpropInput 支持 Ascend950 实现 SIMT
NA
Dilation2DBackpropInput 是形态学膨胀操作 Dilation2D 的反向传播(输入梯度)算子。给定前向输入 x、滤波器 filter 和输出梯度 out_backprop,计算输入梯度 in_backprop。
前向 Dilation2D 公式:
output[b, h_out, w_out, d] = max_{fh, fw} (x[b, h_outstride_h + fhrate_h, w_outstride_w + fwrate_w, d] + filter[fh, fw, d])
反向 BackpropInput 公式:
in_backprop[b, , , d] = 0 # 初始化为零 for each output position (b, h_out, w_out, d): # 找到前向计算时的 argmax 位置(第一个最大值,使用 > 严格大于) (h_in_max, w_in_max) = argmax_{fh, fw} ( x[b, h_beg + fhrate_h, w_beg + fwrate_w, d] + filter[fh, fw, d] ) # 其中 h_beg = h_out * stride_h - pad_top, w_beg = w_out * stride_w - pad_left # 越界位置(h_in < 0 或 h_in >= input_rows 等)跳过,不参与 argmax # NaN 值跳过(val != val 时 continue),不参与 argmax # 若未找到有效 argmax 位置(所有位置越界或 NaN),跳过累加 in_backprop[b, h_in_max, w_in_max, d] += out_backprop[b, h_out, w_out, d]
Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.
Backgroud(背景信息)
增加 Dilation2DBackpropInput 支持 Ascend950 实现 SIMT
Origin(信息来源)
NA
Benefit / Necessity (价值/作用)
Dilation2DBackpropInput 是形态学膨胀操作 Dilation2D 的反向传播(输入梯度)算子。给定前向输入 x、滤波器 filter 和输出梯度 out_backprop,计算输入梯度 in_backprop。
Design(设计方案)
前向 Dilation2D 公式:
output[b, h_out, w_out, d] = max_{fh, fw} (x[b, h_outstride_h + fhrate_h, w_outstride_w + fwrate_w, d] + filter[fh, fw, d])
反向 BackpropInput 公式:
in_backprop[b, , , d] = 0 # 初始化为零
for each output position (b, h_out, w_out, d):
# 找到前向计算时的 argmax 位置(第一个最大值,使用 > 严格大于)
(h_in_max, w_in_max) = argmax_{fh, fw} (
x[b, h_beg + fhrate_h, w_beg + fwrate_w, d] + filter[fh, fw, d]
)
# 其中 h_beg = h_out * stride_h - pad_top, w_beg = w_out * stride_w - pad_left
# 越界位置(h_in < 0 或 h_in >= input_rows 等)跳过,不参与 argmax
# NaN 值跳过(val != val 时 continue),不参与 argmax
# 若未找到有效 argmax 位置(所有位置越界或 NaN),跳过累加
in_backprop[b, h_in_max, w_in_max, d] += out_backprop[b, h_out, w_out, d]