FromFileInitializationStrategy<T>

Models & Types ยท AiDotNet.Initialization

Initialization strategy that loads weights from an external file.

Inheritance: InitializationStrategyBase<T> โ†’ FromFileInitializationStrategy<T>

For Beginners

Transfer learning is like giving your network a head start by using weights that were already trained on a similar task. Instead of starting from random values, you start with values that already know useful patterns.

How It Works

This strategy loads pre-trained weights from a file, enabling transfer learning and model checkpointing. Weights are loaded during the first initialization call and cached for subsequent layers.

Supported formats:

  • JSON: Human-readable format with weight arrays
  • Binary: Compact binary format for faster loading

Constructors

Constructor Summary
FromFileInitializationStrategy(string filePath, WeightFileFormat format) Initializes a new instance of the FromFileInitializationStrategy class.

Properties

Property Summary
bool IsLazy { get; }
bool LoadFromExternal { get; }

Methods

Method Summary
void ClearCache() Clears the cached weights, forcing a reload on next initialization.
void InitializeBiases(Tensor<T> biases)
void InitializeWeights(Tensor<T> weights, int inputSize, int outputSize)
void Reset() Resets the layer indices for a fresh initialization pass.