xlnstorch.csrc.conv2d_backward

xlnstorch.csrc.conv2d_backward#

xlnstorch.csrc.conv2d_backward(grad, x, weight, base, bias_defined, stride_h, stride_w, padding_h, padding_w, dilation_h, dilation_w, groups)#

Perform the backward pass for LNS 2D convolution.

Parameters:
  • grad (torch.Tensor) – The gradient tensor in LNS format (torch.int64).

  • x (torch.Tensor) – The input tensor in LNS format (torch.int64).

  • weight (torch.Tensor) – The convolution kernel in LNS format (torch.int64).

  • base (torch.Tensor) – The base for the LNS representation.

  • bias_defined (bool) – Whether the bias tensor is defined.

  • stride_h (int) – The vertical stride of the convolution.

  • stride_w (int) – The horizontal stride of the convolution.

  • padding_h (int) – The vertical padding applied to the input tensor.

  • padding_w (int) – The horizontal padding applied to the input tensor.

  • dilation_h (int) – The vertical dilation factor for the convolution.

  • dilation_w (int) – The horizontal dilation factor for the convolution.

  • groups (int) – The number of groups for the convolution.

Returns:

The output gradient tensor in LNS format (torch.int64).

Return type:

torch.Tensor