Skip to main content

Conv

Conv(in_channels, out_channels, kernel, *, stride=None, padding=None, dilation=None, groups=1, bias=True, padding_mode="zeros", value=None, activation=None, dtype=None, device=None)

A grouped, padded, dilated convolution of any rank over channels-last input; kernel fixes the rank.

Args: in_channels: channels of the input. out_channels: channels of the output. kernel: the kernel extents, one per spatial dimension. stride: per-dimension strides; None means 1. padding: an int or n ints (per-dimension symmetric), or 2n ints as interleaved (low, high) pairs, the runtime's own per-side form; None means 0. dilation: per-dimension dilations; None means 1. groups: input-to-output channel groups. bias: declare the bias slot. padding_mode: how the input is padded ("zeros", "reflect", "replicate", "circular", or a :class:~clika_runtime.PadMode value). value: the constant a "zeros" / "constant" pad fills with (None means 0). activation: a fused epilogue applied to every output (a name such as "relu" or an :class:~clika_runtime.Activation value); None for none. dtype: the weight dtype the layer declares; None declares the default dtype (:func:~clika_runtime.get_default_dtype). A load_state_dict casts the checkpoint to the declared dtype; assign=True adopts the checkpoint's own dtype instead. device: where the layer's tensors live; None declares on the cpu.

__init__​

__init__(self, in_channels: 'int', out_channels: 'int', kernel: 'Sequence[int]', *, stride: 'Sequence[int] | None' = None, padding: 'Sequence[int] | None' = None, dilation: 'Sequence[int] | None' = None, groups: 'int' = 1, bias: 'bool' = True, padding_mode: 'PaddingModeLike' = 'zeros', value: 'float | None' = None, activation: 'ActivationLike' = None, dtype: 'DtypeLike | None' = None, device: 'Device | str | None' = None) -> 'None'

Initialize self. See help(type(self)) for accurate signature.

extra_repr​

extra_repr(self) -> 'str'

extra_repr() -> str

One line of per-class detail for :meth:__repr__; a layer prints its geometry here (in_features=64, out_features=256).

forward​

forward(self, input: 'Tensor') -> 'Tensor'

forward(input) -> Tensor

Channels-last [batch, *spatial, in_channels] to [batch, *spatial', out_channels].

set_weights​

set_weights(self, weight: 'Tensor', bias: 'Tensor | None' = None) -> 'None'

set_weights(weight, bias=None) -> None

Bind the declared slots directly (weight in the [out_channels, *kernel, in_channels // groups] layout); raises RuntimeError on a shape mismatch.