Conv2DLayer class
A 2D convolutional layer.
This layer creates a set of convolutional filters (kernels) that are convolved with the input to produce a stack of output feature maps. It is the primary building block for Convolutional Neural Networks (CNNs).
This implementation takes a single-channel input (2D Matrix) and produces a multi-channel output (3D Tensor).
- Input: A
Tensor<Matrix>representing a single-channel image of shape[height, width]. - Output: A
Tensor<Tensor3D>representing the output feature maps, with a shape of[output_channels, new_height, new_width].
Example
// A layer that creates 8 feature maps using 3x3 kernels.
Layer conv = Conv2DLayer(8, 3, activation: ReLU());
Constructors
- Conv2DLayer(int outChannels, int kernelSize, {String padding = 'valid', ActivationFunction? activation})
Properties
- activation ↔ ActivationFunction?
-
getter/setter pair
-
biases
↔ Tensor<
Vector> -
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
kernels
↔ List<
Tensor< Matrix> > -
getter/setter pair
- kernelSize ↔ int
-
getter/setter pair
- name ↔ String
-
A user-friendly name for the layer (e.g., 'dense', 'lstm').
getter/setter pairoverride-getter
- outChannels ↔ int
-
getter/setter pair
- padding ↔ String
-
getter/setter pair
-
parameters
→ List<
Tensor> -
A list of all trainable tensors (weights and biases) in the layer.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
Tensor input) → void -
Initializes the layer's parameters based on the shape of the first input.
override
-
call(
Tensor input) → Tensor -
The public, callable interface for the layer.
inherited
-
forward(
Tensor input) → Tensor< Tensor3D> -
The core logic of the layer's transformation.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited