code: def softBinning(D, mid, Delta):
      y = 1 - torch.abs(D - mid) / Delta
      return torch.max(torch.tensor([0], dtype=D.dtype).to(D.device), y)
  
file_path: pytorch-metric-learning/tests/losses/test_fastap_loss.py
imports: import torch
  from torch.autograd import Variable
  import unittest
  from pytorch_metric_learning.losses import FastAPLoss
  from ..None import TEST_DEVICE, TEST_DTYPES
  from ..zzz_testing_utils.testing_utils import angle_to_coord
label_desc: Use image node_id 1 for calling a global function with example usage: softBinning(D, mid, Delta) and returns: torch