code: def wing_loss(
      output: torch.Tensor,
      target: torch.Tensor,
      width=5,
      curvature=0.5,
      reduction="mean",
  ):
      """
      https://arxiv.org/pdf/1711.06753.pdf
      :param output:
      :param target:
      :param width:
      :param curvature:
      :param reduction:
      :return:
      """
      diff_abs = (target - output).abs()
      loss = diff_abs.clone()
  
      idx_smaller = diff_abs < width
      idx_bigger = diff_abs >= width
  
      loss[idx_smaller] = width * torch.log(
          1 + diff_abs[idx_smaller] / curvature
      )
  
      C = width - width * math.log(1 + width / curvature)
      loss[idx_bigger] = loss[idx_bigger] - C
  
      if reduction == "sum":
          loss = loss.sum()
  
      if reduction == "mean":
          loss = loss.mean()
  
      return loss
  
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 7 for calling a global function with example usage: wing_loss(output, target, width, curvature, reduction) and returns: loss