pub fn sparse_conv2d(
input: &SparseTensor,
weight: &Tensor,
bias: Option<&Tensor>,
stride: (usize, usize),
padding: (usize, usize),
dilation: (usize, usize),
) -> Result<SparseTensor>Expand description
Sparse 2D convolution
Performs 2D convolution on sparse input tensors with dense kernels. Optimized for sparse inputs by only processing non-zero elements.
§Mathematical Formula
For input x and kernel w:
y[b, o, h, w] = Σ(x[b, i, h + kh*dh - ph, w + kw*dw - pw] * w[o, i, kh, kw]) + bias[o]
where b=batch, o=output channel, i=input channel, h,w=spatial positions, kh,kw=kernel positions
§Arguments
input- Sparse input tensor [batch_size, channels, height, width]weight- Dense weight tensor [out_channels, in_channels, kernel_height, kernel_width]bias- Optional bias tensor [out_channels]stride- Convolution stride (height, width)padding- Zero padding (height, width)dilation- Kernel dilation (height, width)
§Returns
Sparse output tensor after convolution