code: def soft_margin_loss(
      input: tf.Tensor,
      target: tf.Tensor,
      /,
      *,
      reduction: Optional[str] = "mean",
  ) -> tf.Tensor:
      loss = tf.reduce_sum(
          tf.math.log1p(tf.exp(-input * target))
      ) / tf.size(input)
  
      if reduction == "sum":
          return tf.reduce_sum(loss)
      elif reduction == "mean":
          return tf.reduce_mean(loss)
      else:
          return loss
  
file_path: ivy/ivy/functional/backends/tensorflow/experimental/losses.py
imports: import tensorflow
  import math
  from typing import Optional
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_device_and_dtypes
  from .None import backend_version
label_desc: Use image node_id 3 for calling a global function with example usage: soft_margin_loss() and returns: tf, tf, loss