SNetwork class
A sequential neural network architecture that linearly stacks and executes Layer instances. Manages sequential forward propagation, parameter aggregation across constituent layers, training loops via fit, weight serialization to JSON via save and load, and autograd graph visualization.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
layers
↔ List<
Layer> -
Ordered list of Layer instances composing the sequential pipeline.
getter/setter pair
- name ↔ String
-
The assigned name of this network architecture for debugging and inspection.
getter/setter pairoverride-getter
- optimizer ↔ Optimizer
-
The Optimizer assigned via compile to update network parameters during training.
getter/setter pair
-
parameters
→ List<
Tensor> -
Returns all trainable parameters aggregated across every layer in layers.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
Tensor input) → void -
Allocates and initializes weights/biases based on the incoming input shape. The Tensor
inputwill be used for the setup and therefore should match the exact Tensor shape used in forward.inherited -
call(
Tensor input) → Tensor -
Helper function that, if not overwritten, checks whether build has already been called; if not, it calls build and only then forward.
inherited
-
compile(
{required Optimizer configuredOptimizer}) → void -
Configures the network by binding the specified
configuredOptimizerfor subsequent training. -
evaluate(
List< List< inputs, List<double> >List< targets) → doubledouble> > -
Computes binary classification accuracy on
inputsandtargetsby thresholding predictions at 0.5. -
fit(
List< List< inputs, List<double> >List< targets, {int epochs = 100, bool averageWeight = false, bool debug = true}) → voiddouble> > -
Trains the network parameters on provided
inputsandtargetsoverepochsusing MSE loss and the assigned optimizer. -
forward(
Tensor input) → Tensor -
Sequentially executes the forward pass across each layer in layers, routing each output to the subsequent layer.
override
-
getWeights(
) → Map< String, dynamic> -
Serializes the weights of all parameterized layers into an indexed map.
override
-
inspectGraph(
List< double> inputData, List<double> targetData) → void -
Executes a forward pass with
inputDataandtargetDatato compute MSE loss and prints the autograd compute graph. -
load(
String filePath) → Future< void> -
Reads serialized network weights from a JSON file at
filePathand applies them to the network layers. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
predict(
Tensor input) → Tensor -
Executes an inference pass on the given
inputtensor by invoking the layer call pipeline. -
save(
String filePath) → Future< void> -
Serializes network weights into formatted JSON and saves the output to
filePath. -
setWeights(
Map< String, dynamic> networkWeights) → void -
Deserializes and loads weights into each parameterized layer from the provided
networkWeightsmap.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited