code: def clip(
      x: np.ndarray,
      /,
      x_min: Optional[Union[Number, np.ndarray]] = None,
      x_max: Optional[Union[Number, np.ndarray]] = None,
      *,
      out: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      promoted_type = x.dtype
      if x_min is not None:
          if not hasattr(x_min, "dtype"):
              x_min = ivy.array(x_min).data
          promoted_type = ivy.as_native_dtype(
              ivy.promote_types(x.dtype, x_min.dtype)
          )
      if x_max is not None:
          if not hasattr(x_max, "dtype"):
              x_max = ivy.array(x_max).data
          promoted_type = ivy.as_native_dtype(
              ivy.promote_types(promoted_type, x_max.dtype)
          )
      return np.clip(x.astype(promoted_type), x_min, x_max, out=out)
  
imports: import math
  from numbers import Number
  from typing import Union, Tuple, Optional, List, Sequence
  import numpy
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from .None import backend_version
label_desc: Use image node_id 17 for calling a global function with example usage: clip(x_min, x_max) and returns: np