conv2d

abstract fun conv2d(outChannels: Int, kernelSize: Pair<Int, Int>, stride: Pair<Int, Int> = 1 to 1, padding: Pair<Int, Int> = 0 to 0, dilation: Pair<Int, Int> = 1 to 1, groups: Int = 1, bias: Boolean = true, id: String = "", content: CONV2D<T, V>.() -> Unit = {})(source)

Creates a 2D convolutional layer for processing spatial data like images.

Parameters

outChannels

Number of output channels/filters

kernelSize

Size of the convolving kernel (height, width)

stride

Stride of the convolution (default: 1, 1)

padding

Padding added to all sides of the input (default: 0, 0)

dilation

Spacing between kernel elements (default: 1, 1)

groups

Number of groups for grouped convolution (default: 1)

bias

Whether to add a learnable bias (default: true)

id

Optional identifier for the layer

content

Configuration block for weights and bias initialization


abstract fun conv2d(id: String = "", content: CONV2D<T, V>.() -> Unit)(source)

Creates a 2D convolutional layer with all parameters configured inside the DSL block. Example: conv2d("conv1") { outChannels = 16 kernelSize(5) stride(1) padding(2) }