code: def log_cosh_loss(
      y_pred: torch.Tensor, y_true: torch.Tensor
  ) -> torch.Tensor:
      """
      Numerically stable log-cosh implementation.
      Reference: https://datascience.stackexchange.com/questions/96271/logcoshloss-on-pytorch
  
      Args:
          y_pred:
          y_true:
  
      Returns:
  
      """
  
      def _log_cosh(x: torch.Tensor) -> torch.Tensor:
          return (
              x + torch.nn.functional.softplus(-2.0 * x) - math.log(2.0)
          )
  
      return torch.mean(_log_cosh(y_pred - y_true))
  
file_path: pytorch-toolbelt/pytorch_toolbelt/losses/functional.py
imports: import math
  from typing import Optional
  import torch
  import torch.nn.functional
  from ..utils import pytorch_toolbelt_deprecated
label_desc: Use image node_id 9 for calling a global function with example usage: log_cosh_loss(y_pred, y_true) and returns: torch, unknown