Class ZeroInitializationStrategy<T>
- Namespace
- AiDotNet.Initialization
- Assembly
- AiDotNet.dll
Zero initialization strategy that sets all weights to zero.
public class ZeroInitializationStrategy<T> : InitializationStrategyBase<T>, IInitializationStrategy<T>
Type Parameters
TThe numeric type used for calculations.
- Inheritance
-
ZeroInitializationStrategy<T>
- Implements
- Inherited Members
Remarks
This strategy initializes all weights to zero. It is primarily useful for testing to ensure deterministic behavior, or for specific network architectures where zero initialization is desired for certain layers.
Warning: Zero initialization typically should not be used for training as it prevents symmetry breaking and leads to poor learning. Use for testing only.
Properties
IsLazy
Gets a value indicating whether this strategy defers initialization until first use.
public override bool IsLazy { get; }
Property Value
- bool
trueif initialization is deferred until first Forward() call;falseif initialization happens immediately.
LoadFromExternal
Gets a value indicating whether weights should be loaded from an external source.
public override bool LoadFromExternal { get; }
Property Value
- bool
trueif weights should be loaded from file or other external source;falseif weights should be randomly initialized.
Methods
InitializeBiases(Tensor<T>)
Initializes the biases tensor with appropriate values.
public override void InitializeBiases(Tensor<T> biases)
Parameters
biasesTensor<T>The biases tensor to initialize.
InitializeWeights(Tensor<T>, int, int)
Initializes the weights tensor with appropriate values.
public override void InitializeWeights(Tensor<T> weights, int inputSize, int outputSize)