code: def softmax(
      x: np.ndarray,
      /,
      *,
      axis: Optional[int] = None,
      out: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      axis = -1 if axis is None else axis
      exp_x = np.exp(x - np.max(x, axis=axis, keepdims=True))
      return np.divide(
          exp_x, np.sum(exp_x, axis=axis, keepdims=True), out=out
      )
  
file_path: ivy/ivy/functional/backends/numpy/activations.py
imports: from typing import Optional, Union, Literal
  import numpy
  import ivy
  from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
label_desc: Use image node_id 5 for calling a global function with example usage: softmax() and returns: np