![]() |
Deepity
Ultra-fast, SIMD-accelerated Predictive Coding
|
PC layer with Gauss-Seidel (sequential-sweep) settling dynamics, in place of the usual simultaneous update. Not yet gradient-checked – see the file-level warning above. More...
#include <GaussSeidelPCLayer.h>
Public Member Functions | |
| GaussSeidelPCLayer (int size, int nextSize, int batchSize=1, float learningRate=1e-6f, float inferenceRate=0.1f, float lmbda=1e-2f, void(*act)(float *, size_t)=relu, void(*dAct)(float *, size_t, bool)=dRelu) | |
| Constructor for a GaussSeidelPCLayer. | |
| GaussSeidelPCLayer (int size, int nextSize, int batchSize=1, float learningRate=1e-6f, float inferenceRate=0.1f, float lmbda=1e-2f, ActivationType aType=ActivationType::RELU, ActivationType dType=ActivationType::dRELU) | |
| Constructor using a named ActivationType instead of raw function pointers. | |
| float | CalculateState () noexcept override |
| Step 1 of a Gauss-Seidel timestep: updates z using mu/e_above HELD OVER from the end of the previous timestep. Does NOT mutate mu – computes its derivative into a separate scratch buffer. | |
| void | UpdateState () noexcept override |
| Step 1: the actual z-update. See class-level docs for the required three-sweep calling order. | |
| void | ComputePrediction () noexcept |
| Step 2 of a Gauss-Seidel timestep: recomputes mu fresh, using the z JUST updated by UpdateState() in this same timestep. Call on EVERY layer before any layer's ComputeError(). | |
| float | ComputeError () noexcept |
| Step 3 of a Gauss-Seidel timestep: recomputes e fresh, using this layer's own (just-updated) z as the target and layerBelow's FRESH mu (from its ComputePrediction() call) as the prediction. | |
| void | UpdateWeights () noexcept override |
| Computes weight updates via gradient descent, with L2 weight decay. Called once after the full settling loop completes, matching ngc-learn's evolve_process. | |
| void | Flush () noexcept override |
| No-op; exists for Layer interface conformance. | |
| void | ClampState (const std::vector< float > &inputData) noexcept |
| Clamps this layer's beliefs to externally-provided data. | |
| void | UnclampState () noexcept |
| Releases a previous ClampState() call. | |
| float * | GetBeliefs () noexcept override |
| Returns this layer's belief buffer. | |
| const float * | GetMu () const noexcept |
| Returns this layer's outgoing prediction buffer. | |
| const float * | GetErrors () const noexcept override |
| Returns this layer's prediction-error buffer. | |
| size_t | GetInputSize () const noexcept override |
| Returns this layer's own belief size. | |
| size_t | GetOutputSize () const noexcept override |
| Returns this layer's outgoing prediction size (0 for a terminal layer). | |
| size_t | GetBatchSize () const noexcept override |
| Returns the batch size this layer was constructed with. | |
| const float * | GetWeights () const noexcept |
| Returns a read-only version of the stored weights. | |
| float * | GetWeights () noexcept |
| Returns a mutable version of the stored weights. | |
| const float * | GetBiases () const noexcept |
| Returns a read-only version of the stored biases. | |
| float * | GetBiases () noexcept |
| Returns a mutable version of the stored biases. | |
| float | GetLearningRate () const noexcept |
| Returns the learning rate used for weight updates. | |
| float | GetInferenceRate () const noexcept |
| Returns the inference rate (Euler integration step size). | |
| float | GetLambda () const noexcept |
| Returns the weight-decay (L2 regularization) coefficient. | |
| void | SetLearningRate (float lr) noexcept |
| Sets the learning rate used for weight updates. | |
| void | SetInferenceRate (float ir) noexcept |
| Sets the inference rate (Euler integration step size). | |
| void | SetLambda (float l) noexcept |
| Sets the weight-decay (L2 regularization) coefficient. | |
| void | SetOptimizer (const OptimizerType o) noexcept |
| Selects the optimizer used for weight updates. | |
| void | SetLayerAbove (GaussSeidelPCLayer *above) noexcept |
| Sets the layer immediately above this one in the network. | |
| void | SetLayerBelow (GaussSeidelPCLayer *below) noexcept |
| Sets the layer immediately below this one in the network. | |
| void | ResetState () noexcept |
| Resets beliefs/errors/predictions back to their initial values, without touching learned weights. | |
| const GaussSeidelPCLayer & | GetLayerAbove () const noexcept |
| Returns the layer immediately above this one. | |
| const GaussSeidelPCLayer & | GetLayerBelow () const noexcept |
| Returns the layer immediately below this one. | |
| void | RandomizeWeights (std::mt19937 &twister) noexcept |
| Randomizes this layer's weights (and the E feedback-alignment matrix) in place. | |
| ActivationType | GetActivationType () const noexcept |
| Returns this layer's configured activation type. | |
| ActivationType | GetDerivativeType () const noexcept |
| Returns this layer's configured activation-derivative type. | |
| size_t | GetRequiredFloats () const noexcept |
| Computes the total number of floats this layer requires from a MemoryArena. | |
| void | BindMemory (MemoryArena &arena) |
| Binds this layer's weight/state/scratch buffers into the supplied arena. Must be called before any other operation. | |
| Public Member Functions inherited from Deep::Layer | |
| virtual | ~Layer ()=default |
| virtual std::map< std::string, TensorDescriptor > | GetStateDict () const |
| Returns a dictionary of this. | |
Friends | |
| class | GaussSeidelPCNDiagnostics |
Additional Inherited Members | |
| Protected Attributes inherited from Deep::Layer | |
| size_t | size |
| Size of input. | |
| size_t | nextSize |
| Size of output. | |
PC layer with Gauss-Seidel (sequential-sweep) settling dynamics, in place of the usual simultaneous update. Not yet gradient-checked – see the file-level warning above.
| Deep::GaussSeidelPCLayer::GaussSeidelPCLayer | ( | int | size, |
| int | nextSize, | ||
| int | batchSize = 1, | ||
| float | learningRate = 1e-6f, | ||
| float | inferenceRate = 0.1f, | ||
| float | lmbda = 1e-2f, | ||
| void(* | act )(float *, size_t) = relu, | ||
| void(* | dAct )(float *, size_t, bool) = dRelu ) |
Constructor for a GaussSeidelPCLayer.
| size | Size of this layer's own belief (z) |
| nextSize | Size of the layer above's belief (this layer's outgoing prediction target); 0 marks a terminal layer |
| batchSize | Batch size |
| learningRate | Learning rate for weight updates |
| inferenceRate | Inference rate (Euler integration step size) |
| lmbda | Weight decay (L2 regularization) coefficient |
| act | Activation function |
| dAct | Derivative of activation function |
| Deep::GaussSeidelPCLayer::GaussSeidelPCLayer | ( | int | size, |
| int | nextSize, | ||
| int | batchSize = 1, | ||
| float | learningRate = 1e-6f, | ||
| float | inferenceRate = 0.1f, | ||
| float | lmbda = 1e-2f, | ||
| ActivationType | aType = ActivationType::RELU, | ||
| ActivationType | dType = ActivationType::dRELU ) |
Constructor using a named ActivationType instead of raw function pointers.
| size | Size of this layer's own belief (z) |
| nextSize | Size of the layer above's belief (this layer's outgoing prediction target); 0 marks a terminal layer |
| batchSize | Batch size |
| learningRate | Learning rate for weight updates |
| inferenceRate | Inference rate (Euler integration step size) |
| lmbda | Weight decay (L2 regularization) coefficient |
| aType | Activation type |
| dType | Activation derivative type |
| void Deep::GaussSeidelPCLayer::BindMemory | ( | MemoryArena & | arena | ) |
Binds this layer's weight/state/scratch buffers into the supplied arena. Must be called before any other operation.
| arena | The MemoryArena to bind into. |
|
inlineoverridevirtualnoexcept |
Step 1 of a Gauss-Seidel timestep: updates z using mu/e_above HELD OVER from the end of the previous timestep. Does NOT mutate mu – computes its derivative into a separate scratch buffer.
Implements Deep::Layer.
|
noexcept |
Clamps this layer's beliefs to externally-provided data.
| inputData | Flattened input data of length size. |
|
noexcept |
Step 3 of a Gauss-Seidel timestep: recomputes e fresh, using this layer's own (just-updated) z as the target and layerBelow's FRESH mu (from its ComputePrediction() call) as the prediction.
|
noexcept |
Step 2 of a Gauss-Seidel timestep: recomputes mu fresh, using the z JUST updated by UpdateState() in this same timestep. Call on EVERY layer before any layer's ComputeError().
|
inlineoverridevirtualnoexcept |
No-op; exists for Layer interface conformance.
Reimplemented from Deep::Layer.
|
inlinenoexcept |
Returns this layer's configured activation type.
|
inlineoverridevirtualnoexcept |
Returns the batch size this layer was constructed with.
Implements Deep::Layer.
|
inlineoverridevirtualnoexcept |
|
inlinenoexcept |
Returns a read-only version of the stored biases.
|
inlinenoexcept |
Returns a mutable version of the stored biases.
|
inlinenoexcept |
Returns this layer's configured activation-derivative type.
|
inlineoverridevirtualnoexcept |
|
inlinenoexcept |
Returns the inference rate (Euler integration step size).
|
inlineoverridevirtualnoexcept |
|
inlinenoexcept |
Returns the weight-decay (L2 regularization) coefficient.
|
inlinenoexcept |
Returns the layer immediately above this one.
|
inlinenoexcept |
Returns the layer immediately below this one.
|
inlinenoexcept |
Returns the learning rate used for weight updates.
|
inlinenoexcept |
Returns this layer's outgoing prediction buffer.
|
inlineoverridevirtualnoexcept |
Returns this layer's outgoing prediction size (0 for a terminal layer).
Implements Deep::Layer.
|
noexcept |
Computes the total number of floats this layer requires from a MemoryArena.
|
inlinenoexcept |
Returns a read-only version of the stored weights.
|
inlinenoexcept |
Returns a mutable version of the stored weights.
|
noexcept |
Randomizes this layer's weights (and the E feedback-alignment matrix) in place.
| twister | The classic Mersenne Twister |
|
noexcept |
Resets beliefs/errors/predictions back to their initial values, without touching learned weights.
|
inlinenoexcept |
Sets the inference rate (Euler integration step size).
| ir | The new inference rate. |
|
inlinenoexcept |
Sets the weight-decay (L2 regularization) coefficient.
| l | The new lambda value. |
|
inlinenoexcept |
Sets the layer immediately above this one in the network.
| above | Pointer to the layer above; may be nullptr for a terminal layer. |
|
inlinenoexcept |
Sets the layer immediately below this one in the network.
| below | Pointer to the layer below; may be nullptr for the input layer. |
|
inlinenoexcept |
Sets the learning rate used for weight updates.
| lr | The new learning rate. |
|
inlinenoexcept |
Selects the optimizer used for weight updates.
| o | The optimizer type to use. |
|
noexcept |
Releases a previous ClampState() call.
|
overridevirtualnoexcept |
Step 1: the actual z-update. See class-level docs for the required three-sweep calling order.
Implements Deep::Layer.
|
overridevirtualnoexcept |
Computes weight updates via gradient descent, with L2 weight decay. Called once after the full settling loop completes, matching ngc-learn's evolve_process.
Implements Deep::Layer.
|
friend |