Dense class
Simple fully-connected Layer
Execute regular logic of dense-connected layer over given input data inputs
:
activation.function(weights*inputs+biases)
Example:
// without NeuralNetwork
final inputs = Matrix.column([-1, 1, 2]); // inputs len == 3
final dense = Dense(1, activation: Activation.elu());
dense.init(3);
final output = dense.act(inputs);
print(output); // output is matrix 1⨯1
// within NeuralNetwork
final nn = NeuralNetwork(10, [
Dense(32, activation: Activation.swish()),
Dense(1, activation: Activation.linear(), useBiases: false)
], loss: Loss.mse());
Constructors
- Dense(int units, {Activation? activation, String? name, bool? useBiases})
Properties
-
activatedDerivativeBuffer
↔ List<
Matrix> ? -
Derivatives of the activation function used in the learning process
getter/setter pairinherited
- activation ↔ Activation
-
Activation function of the Dense layer
getter/setter pair
- b ↔ Matrix?
-
Matrix.column of the
biases
of the Layergetter/setter pairinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- inputDataBuffer ↔ Matrix?
-
Input data buffer used in the learning proccess
getter/setter pairinherited
- name ↔ String?
-
The name of the layer
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- trainable ↔ bool
-
Identify if this is trainable
getter/setter pairinherited
- units ↔ int
-
Number of rows in output Matrix.column after activation (or applying) of the Layer over input data
getter/setter pairinherited
- useBiases → bool
-
Defines if train biases or keep them as zero vector
finalinherited
- w ↔ Matrix?
-
Matrix of the
weights
of the Layergetter/setter pairinherited - wasInitialized ↔ bool
-
Identify if initialization was called
getter/setter pairinherited
Methods
-
act(
dynamic inputs, {bool train = false}) → Matrix -
Perform logic of Dense layer
override
-
clear(
) → void -
After-training method, typically clear buffered data from the training process
inherited
-
init(
[dynamic dims]) → void -
Set initial values to weights and biases
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited