pub fn conv2d_backward<T: Triton, D: Num, const KH: i32, const KW: i32, const STRIDE_H: i32, const STRIDE_W: i32, const PAD_H: i32, const PAD_W: i32, const G: i32, const BLOCK_OW: i32>(
dy_ptr: T::Pointer<D>,
x_ptr: T::Pointer<D>,
w_ptr: T::Pointer<D>,
dx_ptr: T::Pointer<D>,
dw_ptr: T::Pointer<D>,
_B: i32,
C_IN: i32,
C_OUT: i32,
H: i32,
W: i32,
OH: i32,
OW: i32,
)where
T::I32Tensor: Tensor<i32, 1> + Comparison<i32, BoolTensor = T::BoolTensor>,
T::BoolTensor: BitAnd<Output = T::BoolTensor>,
T::Pointer<D>: AddOffsets<i32, 1, T::I32Tensor, Output = T::Tensor<T::Pointer<D>>>,Expand description
2-D convolution combined backward pass — computes both dx and dw in one
kernel launch, using the same grid as the forward pass.
Grid: pid = ((b * C_OUT + c_out) * OH + oh) * num_ow_tiles + ow_tile
For each (c_in_local, kh, kw) combination:
dx:atomic_add(dx_ptr[b, c_in, ih, iw], dy * w)dw:atomic_add(dw_ptr[c_out, c_in_local, kh, kw], sum(dy * x))
Both dx_ptr and dw_ptr must be zero-initialised before launch.