![]() |
Deepity
Ultra-fast, SIMD-accelerated Predictive Coding
|
Convolutional Predictive Coding Network built from ConvPCLayer. More...
#include <ConvPCNetwork.h>
Public Member Functions | |
| ConvPCNetwork (int batchSize) noexcept | |
| Constructs an empty network; add layers via AddLayer(), then Compile() before use. | |
| ~ConvPCNetwork ()=default | |
| ConvPCNetwork (const ConvPCNetwork &)=delete | |
| ConvPCNetwork & | operator= (const ConvPCNetwork &)=delete |
| void | AddLayer (int inChannels, int outChannels, int inHeight, int inWidth, int kernelH, int kernelW, int strideH=1, int strideW=1, int padH=0, int padW=0, float lr=1e-6f, float ir=0.1f, float pr=0.01f, float lmbda=1e-2f, ActivationType aType=ActivationType::RELU, ActivationType dType=ActivationType::dRELU) |
| Adds a convolutional layer. Pass outChannels=0 to mark a terminal layer (no outgoing prediction). | |
| void | Compile () |
| Sums every layer's required float count into a single contiguous arena and binds each layer into it. Call after all AddLayer() calls, before RandomizeWeights(). | |
| void | RandomizeWeights (std::mt19937 &rng) noexcept |
| Initializes every layer's weights randomly. | |
| void | ResetState () noexcept |
| Resets the beliefs (z) on every layer. | |
| void | Clamp (const std::vector< float > &input) noexcept |
| Clamps the flattened, batched input to the first (input) layer. | |
| float | CalculateState () noexcept |
| Computes and returns the network's total energy at the current state, without changing it. | |
| void | UpdateState () noexcept |
| Runs one settling step on every layer. | |
| void | UpdateWeights () noexcept |
| Applies weight updates to every layer. | |
| void | UpdatePrecision () noexcept |
| Applies precision updates to every layer. | |
| ConvPCLayer * | GetTerminalLayer () noexcept |
| Returns the last layer (outChannels==0, the terminal one). | |
| const auto & | GetLayers () const noexcept |
| Returns every layer in the network, in the order they were added. | |
| int | GetBatchSize () const noexcept |
| Returns the batch size given at construction. | |
| float | TrainStep (const std::vector< float > &x, const std::vector< float > &y, int inferenceSteps) |
| Full train step: clamp input+target, settle for inferenceSteps, update weights once, return the final energy. | |
| std::vector< float > | Predict (const std::vector< float > &x, int inferenceSteps) |
| Clamps input only, settles, and returns the terminal layer's settled beliefs (flattened, batched). | |
| void | ProjectForward () noexcept |
| Seeds hidden layers from a genuine forward pass through current weights, instead of zero-init. Call after Clamp(), before the settling loop. | |
| float | TrainStepWithProjection (const std::vector< float > &x, const std::vector< float > &y, int inferenceSteps) |
| Full train step with forward-projection init: clamp input, project forward, clamp target, settle, update weights, return the final energy. | |
| std::vector< float > | PredictWithProjection (const std::vector< float > &x, int inferenceSteps) |
| Inference-only counterpart to TrainStepWithProjection(): clamp input, project forward, settle, read out the terminal layer's beliefs. No target clamp, no weight update. | |
Friends | |
| class | PCNDiagnostics |
Convolutional Predictive Coding Network built from ConvPCLayer.
|
explicitnoexcept |
Constructs an empty network; add layers via AddLayer(), then Compile() before use.
| batchSize | Fixed batch size for every layer. |
|
default |
|
delete |
| void Deep::ConvPCNetwork::AddLayer | ( | int | inChannels, |
| int | outChannels, | ||
| int | inHeight, | ||
| int | inWidth, | ||
| int | kernelH, | ||
| int | kernelW, | ||
| int | strideH = 1, | ||
| int | strideW = 1, | ||
| int | padH = 0, | ||
| int | padW = 0, | ||
| float | lr = 1e-6f, | ||
| float | ir = 0.1f, | ||
| float | pr = 0.01f, | ||
| float | lmbda = 1e-2f, | ||
| ActivationType | aType = ActivationType::RELU, | ||
| ActivationType | dType = ActivationType::dRELU ) |
Adds a convolutional layer. Pass outChannels=0 to mark a terminal layer (no outgoing prediction).
|
noexcept |
Computes and returns the network's total energy at the current state, without changing it.
|
noexcept |
Clamps the flattened, batched input to the first (input) layer.
| void Deep::ConvPCNetwork::Compile | ( | ) |
Sums every layer's required float count into a single contiguous arena and binds each layer into it. Call after all AddLayer() calls, before RandomizeWeights().
|
inlinenoexcept |
Returns the batch size given at construction.
|
inlinenoexcept |
Returns every layer in the network, in the order they were added.
|
inlinenoexcept |
Returns the last layer (outChannels==0, the terminal one).
|
delete |
| std::vector< float > Deep::ConvPCNetwork::Predict | ( | const std::vector< float > & | x, |
| int | inferenceSteps ) |
Clamps input only, settles, and returns the terminal layer's settled beliefs (flattened, batched).
| std::vector< float > Deep::ConvPCNetwork::PredictWithProjection | ( | const std::vector< float > & | x, |
| int | inferenceSteps ) |
Inference-only counterpart to TrainStepWithProjection(): clamp input, project forward, settle, read out the terminal layer's beliefs. No target clamp, no weight update.
|
noexcept |
Seeds hidden layers from a genuine forward pass through current weights, instead of zero-init. Call after Clamp(), before the settling loop.
|
noexcept |
Initializes every layer's weights randomly.
|
noexcept |
Resets the beliefs (z) on every layer.
| float Deep::ConvPCNetwork::TrainStep | ( | const std::vector< float > & | x, |
| const std::vector< float > & | y, | ||
| int | inferenceSteps ) |
Full train step: clamp input+target, settle for inferenceSteps, update weights once, return the final energy.
| float Deep::ConvPCNetwork::TrainStepWithProjection | ( | const std::vector< float > & | x, |
| const std::vector< float > & | y, | ||
| int | inferenceSteps ) |
Full train step with forward-projection init: clamp input, project forward, clamp target, settle, update weights, return the final energy.
|
noexcept |
Applies precision updates to every layer.
|
noexcept |
Runs one settling step on every layer.
|
noexcept |
Applies weight updates to every layer.
|
friend |