![]() |
Deepity
Ultra-fast, SIMD-accelerated Predictive Coding
|
Convolutional PC layer, precision-free, AdamW-capable, routed through IComputeBackend for GPU portability – see the file-level warning above for the GPU path's verification status. More...
#include <SimpleConvPCLayer.h>
Public Member Functions | |
| SimpleConvPCLayer (int inChannels, int outChannels, int inHeight, int inWidth, int kernelH, int kernelW, int strideH=1, int strideW=1, int padH=0, int padW=0, int batchSize=1, float learningRate=1e-6f, float inferenceRate=0.1f, float lmbda=1e-2f, ActivationType aType=ActivationType::RELU, ActivationType dType=ActivationType::dRELU, IComputeBackend *backend=nullptr) | |
| float | CalculateState () noexcept override |
| Calculates the internal state of the layer. | |
| void | UpdateState () noexcept override |
| Updates the states after calculation. | |
| void | UpdateWeights () noexcept override |
| Updates the weights after state updates. | |
| void | Flush () noexcept override |
| Flushes remaining batches. | |
| void | ClampState (const std::vector< float > &inputData) noexcept |
| Clamps this layer's beliefs to inputData, fixing them against UpdateState() until UnclampState() is called. | |
| void | UnclampState () noexcept |
| Releases a previous ClampState() call. | |
| float * | GetBeliefs () noexcept override |
| Should return belief state z. | |
| const float * | GetErrors () const noexcept override |
| Should return errors e. | |
| size_t | GetInputSize () const noexcept override |
| Should return input size. | |
| size_t | GetOutputSize () const noexcept override |
| Should return output size. | |
| size_t | GetBatchSize () const noexcept override |
| Should return batch size. | |
| const float * | GetWeights () const noexcept |
| Returns the weight tensor, shape [outChannels, inChannels*kernelH*kernelW]. | |
| float * | GetWeights () noexcept |
| Mutable overload of GetWeights() above. | |
| const float * | GetBiases () const noexcept |
| Returns the bias vector, length outChannels. | |
| float * | GetBiases () noexcept |
| Mutable overload of GetBiases() above. | |
| float | GetLearningRate () const noexcept |
| Returns the current learning rate. | |
| float | GetInferenceRate () const noexcept |
| Returns the current inference rate. | |
| float | GetLambda () const noexcept |
| Returns the current weight decay coefficient. | |
| void | SetLearningRate (float lr) noexcept |
| Sets the learning rate, propagating it to the optimizer state. | |
| void | SetInferenceRate (float ir) noexcept |
| Sets the inference rate. | |
| void | SetLambda (float l) noexcept |
| Sets the weight decay coefficient. | |
| void | SetOptimizer (const OptimizerType o) noexcept |
| Sets the weight optimizer. Call BEFORE Compile(). | |
| bool | IsClamped () const noexcept |
| Whether ClampState() is currently active on this layer. | |
| void | SetLayerAbove (SimpleConvPCLayer *above) noexcept |
| Sets the layer immediately above this one in the network. | |
| void | SetLayerBelow (SimpleConvPCLayer *below) noexcept |
| Sets the layer immediately below this one in the network. | |
| void | ComputeMuOnly () noexcept |
| Computes only mu (forward prediction), skipping error/energy. | |
| void | ResetState () noexcept |
| Resets this layer's beliefs (z) without touching learned weights. | |
| void | RandomizeWeights (std::mt19937 &twister) noexcept |
| Randomizes W/b. | |
| ActivationType | GetActivationType () const noexcept |
| Returns this layer's activation type. | |
| ActivationType | GetDerivativeType () const noexcept |
| Returns this layer's activation derivative type. | |
| const float * | GetMu () const noexcept |
| Returns this layer's forward prediction buffer. | |
| int | GetInChannels () const noexcept |
| Returns the input channel count. | |
| int | GetOutChannels () const noexcept |
| Returns the output channel count (0 for a terminal layer). | |
| int | GetInHeight () const noexcept |
| Returns the input height. | |
| int | GetInWidth () const noexcept |
| Returns the input width. | |
| int | GetOutHeight () const noexcept |
| Returns the output height. | |
| int | GetOutWidth () const noexcept |
| Returns the output width. | |
| int | GetKernelH () const noexcept |
| Returns the kernel height. | |
| int | GetKernelW () const noexcept |
| Returns the kernel width. | |
| size_t | GetRequiredFloats () const noexcept |
| Total floats this layer needs from its MemoryArena. | |
| template<typename ArenaT> | |
| void | BindMemory (ArenaT &arena) |
| Binds this layer's buffers into a pre-allocated arena (MemoryArena for CPU, DeviceMemoryArena for GPU). | |
| 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 | SimpleConvPCNDiagnostics |
Additional Inherited Members | |
| Protected Attributes inherited from Deep::Layer | |
| size_t | size |
| Size of input. | |
| size_t | nextSize |
| Size of output. | |
Convolutional PC layer, precision-free, AdamW-capable, routed through IComputeBackend for GPU portability – see the file-level warning above for the GPU path's verification status.
| Deep::SimpleConvPCLayer::SimpleConvPCLayer | ( | int | inChannels, |
| int | outChannels, | ||
| int | inHeight, | ||
| int | inWidth, | ||
| int | kernelH, | ||
| int | kernelW, | ||
| int | strideH = 1, | ||
| int | strideW = 1, | ||
| int | padH = 0, | ||
| int | padW = 0, | ||
| int | batchSize = 1, | ||
| float | learningRate = 1e-6f, | ||
| float | inferenceRate = 0.1f, | ||
| float | lmbda = 1e-2f, | ||
| ActivationType | aType = ActivationType::RELU, | ||
| ActivationType | dType = ActivationType::dRELU, | ||
| IComputeBackend * | backend = nullptr ) |
| inChannels,outChannels | Input/output channel counts. |
| inHeight,inWidth | Input spatial dimensions. |
| kernelH,kernelW | Convolution kernel size. |
| strideH,strideW | Convolution stride. |
| padH,padW | Zero-padding on each spatial dimension. |
| batchSize | Batch size. |
| learningRate | Learning rate for W/b. |
| inferenceRate | Inference rate (Euler integration step size). |
| lmbda | Weight decay (L2 regularization) coefficient. |
| aType | Activation type. |
| dType | Activation derivative type. |
| backend | Compute backend to run on; defaults to a new CPUBackend if nullptr. |
| template void Deep::SimpleConvPCLayer::BindMemory< DeviceMemoryArena > | ( | ArenaT & | arena | ) |
Binds this layer's buffers into a pre-allocated arena (MemoryArena for CPU, DeviceMemoryArena for GPU).
| ArenaT | Either MemoryArena or DeviceMemoryArena. |
|
overridevirtualnoexcept |
|
noexcept |
Clamps this layer's beliefs to inputData, fixing them against UpdateState() until UnclampState() is called.
|
noexcept |
Computes only mu (forward prediction), skipping error/energy.
|
inlineoverridevirtualnoexcept |
Flushes remaining batches.
Reimplemented from Deep::Layer.
|
inlinenoexcept |
Returns this layer's activation type.
|
inlineoverridevirtualnoexcept |
|
inlineoverridevirtualnoexcept |
|
inlinenoexcept |
Returns the bias vector, length outChannels.
|
inlinenoexcept |
Mutable overload of GetBiases() above.
|
inlinenoexcept |
Returns this layer's activation derivative type.
|
inlineoverridevirtualnoexcept |
|
inlinenoexcept |
Returns the input channel count.
|
inlinenoexcept |
Returns the current inference rate.
|
inlinenoexcept |
Returns the input height.
|
inlineoverridevirtualnoexcept |
|
inlinenoexcept |
Returns the input width.
|
inlinenoexcept |
Returns the kernel height.
|
inlinenoexcept |
Returns the kernel width.
|
inlinenoexcept |
Returns the current weight decay coefficient.
|
inlinenoexcept |
Returns the current learning rate.
|
inlinenoexcept |
Returns this layer's forward prediction buffer.
|
inlinenoexcept |
Returns the output channel count (0 for a terminal layer).
|
inlinenoexcept |
Returns the output height.
|
inlineoverridevirtualnoexcept |
|
inlinenoexcept |
Returns the output width.
|
noexcept |
Total floats this layer needs from its MemoryArena.
|
inlinenoexcept |
Returns the weight tensor, shape [outChannels, inChannels*kernelH*kernelW].
|
inlinenoexcept |
Mutable overload of GetWeights() above.
|
inlinenoexcept |
Whether ClampState() is currently active on this layer.
|
noexcept |
Randomizes W/b.
|
noexcept |
Resets this layer's beliefs (z) without touching learned weights.
|
inlinenoexcept |
Sets the inference rate.
|
inlinenoexcept |
Sets the weight decay coefficient.
|
inlinenoexcept |
Sets the layer immediately above this one in the network.
|
inlinenoexcept |
Sets the layer immediately below this one in the network.
|
noexcept |
Sets the learning rate, propagating it to the optimizer state.
|
inlinenoexcept |
Sets the weight optimizer. Call BEFORE Compile().
|
noexcept |
Releases a previous ClampState() call.
|
overridevirtualnoexcept |
Updates the states after calculation.
Implements Deep::Layer.
|
overridevirtualnoexcept |
Updates the weights after state updates.
Implements Deep::Layer.
|
friend |