code: def softmax(
      x: paddle.Tensor,
      /,
      *,
      axis: Optional[int] = None,
      out: Optional[paddle.Tensor] = None,
  ) -> paddle.Tensor:
      if axis is None:
          axis = -1
  
      if paddle.is_complex(x):
          amax = paddle_backend.max(x, axis=axis, keepdims=True)
      else:
          amax = paddle.max(x, axis, keepdim=True)
      exp_x = paddle_backend.exp(paddle.subtract(x, amax))
      return paddle.divide(
          exp_x, paddle.sum(exp_x, axis=axis, keepdim=True)
      )
  
file_path: ivy/ivy/functional/backends/paddle/activations.py
imports: from typing import Optional, Union, Literal
  import paddle
  import paddle.nn.functional
  import ivy.functional.backends.paddle
  import ivy
  from ivy.func_wrapper import with_unsupported_device_and_dtypes, with_supported_dtypes, with_supported_device_and_dtypes
  from .None import backend_version
label_desc: Use image node_id 5 for calling a global function with example usage: softmax() and returns: paddle