DenseLayerMatrix class
A fully-connected layer that operates on a batch of data (a Matrix).
A DenseLayerMatrix applies the same dense transformation to every row
of the input matrix. It implements the operation: activation(input @ weights + biases).
This is used for batch processing or in architectures like Transformers where sequences of vectors are processed.
- Input: A
Tensor<Matrix>of shape[batch_size, input_size]. - Output: A
Tensor<Matrix>of shape[batch_size, output_size].
Constructors
- DenseLayerMatrix(int outputSize, {ActivationFunction? activation})
Properties
- activation ↔ ActivationFunction?
-
getter/setter pair
-
biases
↔ Tensor<
Vector> -
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- name ↔ String
-
A user-friendly name for the layer (e.g., 'dense', 'lstm').
getter/setter pairoverride-getter
- outputSize ↔ int
-
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
-
weights
↔ Tensor<
Matrix> -
getter/setter pair
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< Matrix> -
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