code: def soft_margin_loss(
      input: Union[ivy.Array, ivy.NativeArray],
      target: Union[ivy.Array, ivy.NativeArray],
      /,
      *,
      reduction: Optional[str] = "mean",
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Compute the soft-margin hinge loss between predicted scores and true
      binary labels.
  
      Parameters
      ----------
      input : array_like
          True binary labels, of shape (batch_size,).
      target : array_like
          Predicted scores, of shape (batch_size,).
      reduction : {'mean', 'sum', 'none'}, optional
          Type of reduction to apply to the output. Default is 'mean'.
      out : array_like, optional
          Optional output array, for writing the result to.
          It must have a shape that the inputs broadcast to.
  
      Returns
      -------
      ret : array
          The soft-margin hinge loss between the predicted scores
          and true binary labels.
  
      Examples
      --------
      >>> input = ivy.array([1, 0, 1, 0])
      >>> target = ivy.array([0.8, 0.2, -0.6, 1.5])
      >>> ivy.soft_margin_loss(input, target)
      ivy.array(0.6987)
  
      >>> input = ivy.array([1, 1, 0, 0])
      >>> target = ivy.array([0.8, 0.7, 0.2, 0.1])
      >>> ivy.soft_margin_loss(input, target, reduction='sum')
      ivy.array(2.1606)
  
      >>> input = ivy.array([1, 1, 0, 0])
      >>> target = ivy.array([0.8, 0.7, 0.2, 0.1])
      >>> ivy.soft_margin_loss(input, target, reduction='none')
      ivy.array([0.3711, 0.4032, 0.6931, 0.6931])
      """
      loss = ivy.sum(ivy.log1p(ivy.exp(-input * target))) / input.size
  
      if reduction == "sum":
          return ivy.sum(loss, out=out)
      elif reduction == "mean":
          return ivy.mean(loss, out=out)
      else:
          return (
              ivy.inplace_update(out, loss) if out is not None else loss
          )
  
file_path: ivy/ivy/functional/ivy/experimental/losses.py
imports: from typing import Union, Optional
  import ivy
  from ivy.func_wrapper import handle_nestable, inputs_to_ivy_arrays, handle_array_like_without_promotion, handle_array_function, to_native_arrays_and_back
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 5 for calling a global function with example usage: soft_margin_loss() and returns: ivy, ivy, unknown