Skip to main content

channel_cat_backward

Function channel_cat_backward 

Source
pub fn channel_cat_backward<T: Triton, D: Num, const BLOCK_SIZE: i32>(
    dy_ptr: T::Pointer<D>,
    dx_ptr: T::Pointer<D>,
    chunk_c: i32,
    c_total: i32,
    chunk_offset: i32,
)
where T::I32Tensor: Tensor<i32, 1> + Comparison<i32, BoolTensor = T::BoolTensor>, T::Pointer<D>: AddOffsets<i32, 1, T::I32Tensor, Output = T::Tensor<T::Pointer<D>>>,
Expand description

Channel-wise cat backward — extracts the gradient slice for one input from the combined upstream gradient tensor.

Index mapping: dx[n * chunk_c + ci] = dy[n * c_total + chunk_offset + ci]

No atomic operations are required: this kernel reads from a specific disjoint channel range of dy and writes to its own output buffer.

Grid: same as channel_cat_forward.