credit.losses.power
===================

.. py:module:: credit.losses.power


Classes
-------

.. autoapisummary::

   credit.losses.power.PSDLoss


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

.. py:class:: PSDLoss(wavenum_init=20)

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


   Power Spectral Density (PSD) Loss Function.

   This loss function calculates the Power Spectral Density (PSD) of the
   predicted and target outputs and compares them to ensure similar frequency
   content in the predictions.

   :param wavenum_init: The initial wavenumber to start considering in the loss calculation.
   :type wavenum_init: int


   .. py:attribute:: wavenum_init
      :value: 20



   .. py:method:: forward(target, pred, weights=None)

      Forward pass for PSD loss.

      :param target: Target tensor.
      :type target: torch.Tensor
      :param pred: Predicted tensor.
      :type pred: torch.Tensor
      :param weights: Latitude weights for the loss.
      :type weights: torch.Tensor, optional

      :returns: PSD loss value.
      :rtype: torch.Tensor



   .. py:method:: get_psd(f_x, device, dtype)


