Python wrappers
Public Python APIs implemented by this engine symbols.- py
lucid.nn.Conv1dclass - py
lucid.nn.qat.Conv1dclass - py
lucid.nn.quantized.Conv1dclass - py
lucid.nn.functional.conv1dfunction - py
lucid.nn.Conv2dclass - py
lucid.nn.qat.Conv2dclass - py
lucid.nn.quantized.Conv2dclass - py
lucid.nn.functional.conv2dfunction - py
lucid.nn.Conv3dclass - py
lucid.nn.qat.Conv3dclass - py
lucid.nn.quantized.Conv3dclass - py
lucid.nn.functional.conv3dfunction
Autograd node for the N-dimensional cross-correlation.
Explicitly instantiated for . The per-axis hyper-
parameters (stride_, pad_, dilation_) are stored as
fixed-size C arrays of length N to avoid heap allocation on the
forward hot path. groups_ partitions both C_in and C_out
into independent filter blocks (groups_ == C_in yields a
depthwise convolution).
Backward emits three gradient slots: dx via a transposed-conv
against W, dW via an im2col-then-matmul against the saved
input, and db via a channel-wise reduction of grad_out.
Attributes
schema_v1OpSchema"conv1d" / "conv2d" / "conv3d") with AmpPolicy::Promote — both inputs are cast to the active AMP compute dtype before dispatch.stride_int[N]pad_int[N]dilation_int[N]groups_int1.Static methods
1forward
→TensorImplPtrint forward(const int & x, const int & W, const int & b, const int (&)[N] stride, const int (&)[N] pad, const int (&)[N] dilation, int groups)Run the forward cross-correlation and attach the backward node.
Parameters
xTensorImplPtr(B, C_in, S_0, ..., S_{N-1}).WTensorImplPtr(C_out, C_in / groups, K_0, ..., K_{N-1}).bTensorImplPtr(C_out,); pass an empty tensor for a bias-less convolution.stridearray<int, N>(s_0, ..., s_{N-1}).padarray<int, N>dilationarray<int, N>groupsintC_in and C_out must be divisible by it. groups == C_in yields depthwise convolution.Returns
TensorImplPtrOutput of shape (B, C_out, O_0, ..., O_{N-1}) where for each spatial axis
Raises
ShapeMismatchN + 2, if C_in / C_out are not divisible by groups, if C_in / groups does not match W's second axis, if b is not 1-D of length C_out, or if the computed output extent is non-positive.DeviceMismatchx, W, b are not all on the same device.Methods
1Backward — compute gradients [dx, dW, db] for the three saved inputs.
Parameters
grad_outStorageReturns
vector<Storage>Three slots in declaration order: dx (transposed-conv), dW (im2col + matmul), db (channel-wise reduction).