credit.models.wxformer.stochastic_decomposition_layer#

Classes#

StochasticDecompositionLayer

A module that injects noise into feature maps, with a per-pixel and per-channel style modulation.

Module Contents#

class credit.models.wxformer.stochastic_decomposition_layer.StochasticDecompositionLayer(noise_dim, feature_channels, noise_factor=0.1)#

Bases: torch.nn.Module

A module that injects noise into feature maps, with a per-pixel and per-channel style modulation.

noise_transform#

A linear transformation to map latent noise to the feature map’s channels.

Type:

nn.Linear

modulation#

A learnable scaling factor applied to the noise.

Type:

nn.Parameter

noise_factor#

A scaling factor for controlling the intensity of the injected noise.

Type:

float

forward(feature_map, noise)#

Adds noise to the feature map, modulated by style and the modulation parameter.

noise_transform#
modulation#
noise_factor#
forward(feature_map, noise)#

Injects noise into the feature map.

Parameters:
  • feature_map (torch.Tensor) – The input feature map (batch, channels, height, width).

  • noise (torch.Tensor) – The latent noise tensor (batch, noise_dim), used for modulating the injected noise.

Returns:

The feature map with injected noise.

Return type:

torch.Tensor