code: def soft_thresholding(
      x: Union[ivy.Array, ivy.NativeArray],
      /,
      threshold: Union[float, ivy.Array, ivy.NativeArray],
      *,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Soft-thresholding operator.
  
          sign(tensor) * max[abs(tensor) - threshold, 0]
  
      Parameters
      ----------
      x
        input array
      threshold
            float or array with shape tensor.shape
          * If float the threshold is applied to the whole tensor
          * If array, one threshold is applied per elements, 0 values are ignored
      out
          optional output array, for writing the result to.
  
      Returns
      -------
      ivy.Array
          thresholded tensor on which the operator has been applied
  
      Examples
      --------
      Basic shrinkage
  
      >>> x = ivy.array([[1, -2, 1.5], [-4, 3, -0.5]])
      >>> soft_thresholding(x, 1.1)
      array([[ 0. , -0.9,  0.4],
             [-2.9,  1.9,  0. ]])
  
  
      Example with missing values
  
      >>> mask = ivy.array([[0, 0, 1], [1, 0, 1]])
      >>> soft_thresholding(x, mask*1.1)
      array([[ 1. , -2. ,  0.4],
             [-2.9,  3. ,  0. ]])
      """
      res = ivy.abs(x) - threshold
      res = ivy.where(res < 0.0, 0.0, res) * ivy.sign(x)
  
      if ivy.exists(out):
          return ivy.inplace_update(out, res)
      return res
  
imports: from typing import Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List
  from numbers import Number
  from functools import partial
  import math
  import ivy
  from ivy.func_wrapper import handle_out_argument, handle_partial_mixed_function, to_native_arrays_and_back, inputs_to_native_shapes, handle_nestable, handle_array_like_without_promotion, handle_view, inputs_to_ivy_arrays, handle_array_function, handle_device, handle_backend_invalid
  from ivy.functional.ivy.general import _numel
  from ivy.utils.backend import current_backend
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 55 for calling a global function with example usage: soft_thresholding(threshold) and returns: res, ivy