![]() |
Deepity
Ultra-fast, SIMD-accelerated Predictive Coding
|
Predictive Coding network built from GaussSeidelPCLayer, sweeping layers sequentially rather than updating them simultaneously. See the file-level warning above on its current verification status. More...
#include <GaussSeidelPCNetwork.h>
Public Member Functions | |
| GaussSeidelPCNetwork (int batchSize) noexcept | |
| Constructs an empty network with a predetermined batch size. | |
| ~GaussSeidelPCNetwork ()=default | |
| Default destructor. | |
| GaussSeidelPCNetwork (const GaussSeidelPCNetwork &)=delete | |
| Copy construction is disabled; a network owns its layers' memory arena and is not meant to be duplicated. | |
| GaussSeidelPCNetwork & | operator= (const GaussSeidelPCNetwork &)=delete |
| Copy assignment is disabled; see the copy constructor. | |
| void | AddLayer (int size, int nextSize, float lr, float ir, float lmbda, void(*act)(float *, size_t), void(*dAct)(float *, size_t, bool)) |
| Adds a layer to the network. | |
| void | AddLayer (int size, int nextSize, float lr, float ir, float lmbda, ActivationType aType, ActivationType dType) |
| Adds a layer to the network, using a named ActivationType instead of raw function pointers. | |
| void | RandomizeWeights (std::mt19937 &rng) |
| Randomizes the weights of each layer. | |
| void | ResetState () noexcept |
| Resets each layer's state without touching learned weights. | |
| void | Clamp (const std::vector< float > &input) |
| Clamps the input to the first layer. | |
| float | Step () noexcept |
| Runs ONE full Gauss-Seidel settling step (all three sweeps, in order) across every layer. | |
| void | UpdateWeights () noexcept |
| Updates every non-terminal layer's weights. Called ONCE after the full settling loop completes, matching ngc-learn's evolve_process. | |
| void | ProjectForward () noexcept |
| Seeds every hidden layer's z from a genuine forward pass through current weights (ComputePrediction() only, no error/energy side effects) – an orthogonal optimization to the Gauss-Seidel restructuring itself. Assumes layers[0] is already clamped. | |
| void | SetOptimizer (OptimizerType o) noexcept |
| Sets the optimizer used for weight updates, on every layer. | |
| void | SetLearningRate (float lr) noexcept |
| Sets the learning rate used for weight updates, on every layer. | |
| GaussSeidelPCLayer * | GetTerminalLayer () noexcept |
| Returns the network's terminal (final) layer. | |
| std::vector< std::unique_ptr< GaussSeidelPCLayer > > & | GetLayers () noexcept |
| Returns every layer in the network, in the order they were added. | |
| const std::vector< std::unique_ptr< GaussSeidelPCLayer > > & | GetLayers () const noexcept |
| Returns every layer in the network, in the order they were added. | |
| int | GetBatchSize () const noexcept |
| Returns the batch size for the network's layers. | |
| float | TrainStep (const std::vector< float > &x, const std::vector< float > &y, int inferenceSteps) |
| Full train step: reset, clamp input+target, settle for inferenceSteps, update weights once, unclamp. | |
| float | TrainStepWithProjection (const std::vector< float > &x, const std::vector< float > &y, int inferenceSteps) |
| Same as TrainStep(), but with ProjectForward() called once after clamping the input, before the settling loop. | |
| std::vector< float > | Predict (const std::vector< float > &x, int inferenceSteps) |
| Forward prediction: clamp input, settle (no target clamped), read the terminal's beliefs. | |
| void | Compile () |
| Loads all layers into one contiguous block of memory. | |
Predictive Coding network built from GaussSeidelPCLayer, sweeping layers sequentially rather than updating them simultaneously. See the file-level warning above on its current verification status.
|
explicitnoexcept |
Constructs an empty network with a predetermined batch size.
| batchSize | Batch size |
|
default |
Default destructor.
|
delete |
Copy construction is disabled; a network owns its layers' memory arena and is not meant to be duplicated.
| void Deep::GaussSeidelPCNetwork::AddLayer | ( | int | size, |
| int | nextSize, | ||
| float | lr, | ||
| float | ir, | ||
| float | lmbda, | ||
| ActivationType | aType, | ||
| ActivationType | dType ) |
Adds a layer to the network, using a named ActivationType instead of raw function pointers.
| size | input size |
| nextSize | output size |
| lr | learning rate for weight updates |
| ir | inference rate (Euler integration step size) |
| lmbda | weight decay (L2 regularization) coefficient |
| aType | activation type |
| dType | activation derivative type |
| void Deep::GaussSeidelPCNetwork::AddLayer | ( | int | size, |
| int | nextSize, | ||
| float | lr, | ||
| float | ir, | ||
| float | lmbda, | ||
| void(* | act )(float *, size_t), | ||
| void(* | dAct )(float *, size_t, bool) ) |
Adds a layer to the network.
| size | input size |
| nextSize | output size |
| lr | learning rate for weight updates |
| ir | inference rate (Euler integration step size) |
| lmbda | weight decay (L2 regularization) coefficient |
| act | activation function |
| dAct | derivative of previous activation function |
| void Deep::GaussSeidelPCNetwork::Clamp | ( | const std::vector< float > & | input | ) |
Clamps the input to the first layer.
| input | Reference to the input vector. |
| void Deep::GaussSeidelPCNetwork::Compile | ( | ) |
Loads all layers into one contiguous block of memory.
|
inlinenoexcept |
Returns the batch size for the network's layers.
|
inlinenoexcept |
Returns every layer in the network, in the order they were added.
|
inlinenoexcept |
Returns every layer in the network, in the order they were added.
|
inlinenoexcept |
Returns the network's terminal (final) layer.
|
delete |
Copy assignment is disabled; see the copy constructor.
| std::vector< float > Deep::GaussSeidelPCNetwork::Predict | ( | const std::vector< float > & | x, |
| int | inferenceSteps ) |
Forward prediction: clamp input, settle (no target clamped), read the terminal's beliefs.
|
noexcept |
Seeds every hidden layer's z from a genuine forward pass through current weights (ComputePrediction() only, no error/energy side effects) – an orthogonal optimization to the Gauss-Seidel restructuring itself. Assumes layers[0] is already clamped.
| void Deep::GaussSeidelPCNetwork::RandomizeWeights | ( | std::mt19937 & | rng | ) |
Randomizes the weights of each layer.
| rng | The classic Mersenne Twister |
|
noexcept |
Resets each layer's state without touching learned weights.
|
inlinenoexcept |
Sets the learning rate used for weight updates, on every layer.
| lr | The new learning rate. |
|
inlinenoexcept |
Sets the optimizer used for weight updates, on every layer.
| o | The optimizer type to apply. |
|
noexcept |
Runs ONE full Gauss-Seidel settling step (all three sweeps, in order) across every layer.
| float Deep::GaussSeidelPCNetwork::TrainStep | ( | const std::vector< float > & | x, |
| const std::vector< float > & | y, | ||
| int | inferenceSteps ) |
Full train step: reset, clamp input+target, settle for inferenceSteps, update weights once, unclamp.
| float Deep::GaussSeidelPCNetwork::TrainStepWithProjection | ( | const std::vector< float > & | x, |
| const std::vector< float > & | y, | ||
| int | inferenceSteps ) |
Same as TrainStep(), but with ProjectForward() called once after clamping the input, before the settling loop.
|
noexcept |
Updates every non-terminal layer's weights. Called ONCE after the full settling loop completes, matching ngc-learn's evolve_process.