credit.models.crossformer_ensemble
==================================

.. py:module:: credit.models.crossformer_ensemble


Attributes
----------

.. autoapisummary::

   credit.models.crossformer_ensemble.logger


Classes
-------

.. autoapisummary::

   credit.models.crossformer_ensemble.CrossFormerWithNoise
   credit.models.crossformer_ensemble.PixelNoiseInjection


Module Contents
---------------

.. py:class:: CrossFormerWithNoise(noise_latent_dim=128, encoder_noise_factor=0.05, decoder_noise_factor=0.275, encoder_noise=True, freeze=True, **kwargs)

   Bases: :py:obj:`credit.models.crossformer.CrossFormer`


   CrossFormer variant with pixel-wise noise injection in both encoder and decoder stages.

   .. attribute:: noise_latent_dim

      Dimensionality of the noise vector.

      :type: int

   .. attribute:: encoder_noise_factor

      Initial scaling factor for encoder noise injection.

      :type: float

   .. attribute:: decoder_noise_factor

      Initial scaling factor for decoder noise injection.

      :type: float

   .. attribute:: encoder_noise

      Whether to apply noise injection in the encoder.

      :type: bool

   .. attribute:: freeze

      Whether to freeze pre-trained model weights.

      :type: bool


   .. py:attribute:: noise_latent_dim
      :value: 128



   .. py:attribute:: encoder_noise
      :value: True



   .. py:attribute:: noise_inject1


   .. py:attribute:: noise_inject2


   .. py:attribute:: noise_inject3


   .. py:method:: forward(x, noise=None, forecast_step=None)

      Forward pass through the CrossFormer with noise injection.

      :param x: Input tensor of shape (batch_size, channels, height, width).
      :type x: Tensor
      :param noise: External noise tensor. If None, noise is sampled internally. Defaults to None.
      :type noise: Tensor, optional

      :returns: Output tensor after passing through the model.
      :rtype: Tensor



.. py:class:: PixelNoiseInjection(noise_dim, feature_channels, noise_factor=0.1)

   Bases: :py:obj:`torch.nn.Module`


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

   .. attribute:: noise_transform

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

      :type: nn.Linear

   .. attribute:: modulation

      A learnable scaling factor applied to the noise.

      :type: nn.Parameter

   .. attribute:: noise_factor

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

      :type: float

   .. method:: forward(feature_map, noise)

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


   .. py:attribute:: noise_transform


   .. py:attribute:: modulation


   .. py:attribute:: noise_factor


   .. py:method:: forward(feature_map, noise)

      Injects noise into the feature map.

      :param feature_map: The input feature map (batch, channels, height, width).
      :type feature_map: torch.Tensor
      :param noise: The latent noise tensor (batch, noise_dim), used for modulating the injected noise.
      :type noise: torch.Tensor

      :returns: The feature map with injected noise.
      :rtype: torch.Tensor



.. py:data:: logger

