WeightLoader

Models & Types · AiDotNet.ComputerVision.Weights

Loads pre-trained model weights from various file formats.

For Beginners

This class reads saved neural network weights from files. Deep learning models are trained on massive datasets, and the learned parameters (weights) can be saved and reloaded. This allows you to use pre-trained models without training from scratch.

How It Works

Supported formats:

  • PyTorch (.pt, .pth) - Python pickle with tensor data
  • SafeTensors (.safetensors) - Safe tensor format
  • NumPy (.npy, .npz) - NumPy array format
  • ONNX (.onnx) - Open Neural Network Exchange format

Constructors

Constructor Summary
WeightLoader() Creates a new weight loader.

Methods

Method Summary
Dictionary<string, Tensor<float>> LoadWeights(string filePath) Loads weights from a file and returns them as a dictionary.