copapy.nn.conv2d#

copapy.nn.conv2d(x, weight, bias=None, stride=1, padding=0, dilation=1)#

2D convolution (cross-correlation as in most deep learning frameworks) computed by a single array stencil.

Parameters:
  • x (TArr) – Input of shape (channels, height, width) or (batch, channels, height, width).

  • weight (array[Any] | ArrayType[Any] | Sequence[Any]) – Kernels of shape (out_channels, channels, kernel_height, kernel_width).

  • bias (array[Any] | ArrayType[Any] | Sequence[Any] | None) – Optional bias of shape (out_channels,).

  • stride (int | Sequence[int]) – Step of the kernel, a single integer or (vertical, horizontal).

  • padding (int | Sequence[int]) – Zero padding on both sides of the input, a single integer or (vertical, horizontal).

  • dilation (int | Sequence[int]) – Spacing between the kernel elements, a single integer or (vertical, horizontal).

Return type:

TArr

Returns:

Float array or tensor (same type as x) of shape (out_channels, out_height, out_width) with a leading batch dimension if x has one.