ControlNetEncoder<T>

Models & Types · AiDotNet.Diffusion.Control

ControlNet encoder per Zhang et al. (2023) “Adding Conditional Control to Text-to-Image Diffusion Models”. Uses convolutional layers (NOT dense/fully-connected) operating on spatial [C, H, W] tensors. Zero convolutions are 1×1 convolutions initialized to zero for safe integration with pretrained models.

Implements: IParameterSource<T>

Constructors

Constructor Summary
ControlNetEncoder(int inputChannels, int baseChannels, int[] channelMultipliers, int imageSize, int? seed) Initializes a new ControlNetEncoder with convolutional layers per the paper.

Properties

Property Summary
long ParameterCount { get; set; } Gets the number of parameters in this encoder.

Methods

Method Summary
List<Tensor<T>> Encode(Tensor<T> controlImage) Encodes a control image into multi-scale features.
Vector<T> GetParameters() Gets all parameters as a vector.
void SetParameters(Vector<T> parameters) Sets all parameters from a vector.