credit.losses.xtanh
===================

.. py:module:: credit.losses.xtanh


Classes
-------

.. autoapisummary::

   credit.losses.xtanh.XTanhLoss


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

.. py:class:: XTanhLoss(reduction='mean')

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


   X-Tanh Loss Function.

   This loss function computes the element-wise product of the prediction error
   and the hyperbolic tangent of the error. This loss function aims to be more
   robust to outliers than traditional MSE.

   :param reduction: Specifies the reduction to apply to the output:
                     'mean' | 'none'. 'mean': the output is averaged; 'none': no reduction is applied.
   :type reduction: str


   .. py:attribute:: reduction
      :value: 'mean'



   .. py:method:: forward(y_t, y_prime_t)

      Forward pass for X-Tanh loss.

      :param y_t: Target tensor.
      :type y_t: torch.Tensor
      :param y_prime_t: Predicted tensor.
      :type y_prime_t: torch.Tensor

      :returns: X-Tanh loss value.
      :rtype: torch.Tensor



