Procs
proc conv2d[TT](input, weight: Variable[TT]; bias: Variable[TT] = nil; padding: Size2D = (0, 0); stride: Size2D = (1, 1)): Variable[TT]
-
Input:
- ``input`` Variable wrapping a 4D Tensor batch of images of the size [N,C_in,H_in,W_in] - ``weight`` Variable wrapping a 4D Tensor convolving kernel weights of the size [C_out,C_in,kH,kW] - ``bias`` Nil-able Variable wrapping a 3D Tensor bias of the size [C_out,1,1] - ``padding`` Size2D tuple with height and width of the padding - ``stride`` Size2D tuple with height and width of the stride
Returns:
- A variable with a convolved 4D Tensor of size [N,C_out,H_out,W_out], where H_out = (H_in + (2*padding.height) - kH) / stride.height + 1 W_out = (W_in + (2*padding.width) - kW) / stride.width + 1
Future TODO: In the future the conv2D layer will allow different input layout
Warning âš :
- Experimental, there is no tests yet for this layer
proc init[T](ctx: Context[Tensor[T]]; layerType: typedesc[Conv2D[T]]; inShape: seq[int]; outChannels: int; kernelSize: Size2D; padding: Size2D = (0, 0); stride: Size2D = (1, 1)): Conv2D[T]
-
Creates a 2D convolutional layer. Input:
- ``inShape`` Shape of the expected input tensor in the form of ``[C_in, H_in, W_in]`` - ``outChannels`` Number of channels in the output - ``kernelSize`` Shape of the kernel ``(width, height)`` - ``padding`` Padding, defaults to ``(0, 0)`` - ``stride`` Stride, defaults to ``(1, 1)``
Returns the created Conv2D.
Source Edit