MLPProjector<T>

Models & Types · AiDotNet.SelfSupervisedLearning

Multi-layer perceptron (MLP) projection head for self-supervised learning.

Implements: IParameterChunkSource<T>, IParameterLayoutSource, IProjectorHead<T>

For Beginners

An MLP projector transforms encoder outputs into a lower-dimensional space optimized for the SSL loss. This is the standard projector used in SimCLR, MoCo v2, BYOL.

How It Works

Architecture:

Why MLP over Linear?

Constructors

Constructor Summary
MLPProjector(int inputDim, int hiddenDim, int outputDim, bool useBatchNormOnOutput, int? seed) Initializes a new instance of the MLPProjector class.

Properties

Property Summary
int InputDimension { get; }
int OutputDimension { get; }
int? HiddenDimension { get; }
long ParameterCount { get; }

Methods

Method Summary
IReadOnlyList<Tensor<T>> GetTrainableTensors()
Tensor<T> Project(Tensor<T> input)
Vector<T> GetParameterGradients()
Vector<T> GetParameters()
void ClearGradients()
void Reset()
void SetParameters(Vector<T> parameters)
void SetTrainingMode(bool isTraining)