code: def logsumexp(
      a, axis=None, b=None, keepdims=False, return_sign=False
  ):
      a = ivy.asarray(a)
      if b is not None:
          dtype = _batch_promotion(a, b, default_dtype="float32")
          a = ivy.astype(a, dtype)
          b = ivy.asarray(b, dtype=dtype)
          a = ivy.where(b != 0, a, -ivy.inf)
          a = ivy.astype(a, dtype)
      out_dtype = _batch_promotion(a, b, default_dtype="float32")
      pos_dims, dims = _reduction_dims(a, axis)
  
      amax = ivy.max(a, axis=pos_dims, keepdims=keepdims)
      notinf = ivy.asarray(not ivy.isinf(amax))
      amax = ivy.stop_gradient(
          ivy.where(notinf, amax, ivy.zeros_like(amax))
      )
      amax_with_dims = (
          amax if keepdims else ivy.expand_dims(amax, axis=pos_dims)
      )
  
      # fast path for non-negative result
      if b is None:
          out = ivy.add(
              ivy.log(
                  ivy.sum(
                      ivy.exp(ivy.subtract(a, amax_with_dims)),
                      axis=dims,
                      keepdims=keepdims,
                  )
              ),
              amax,
          )
          sign = ivy.where(ivy.isnan(out), out, 1.0)
          sign = ivy.where(ivy.isinf(-out), 0.0, sign).astype(out.dtype)
      else:
          expsub = ivy.exp(ivy.subtract(a, amax_with_dims))
          if b is not None:
              expsub = ivy.multiply(expsub, b)
          sumexp = ivy.sum(expsub, axis=dims, keepdims=keepdims)
          sign = ivy.stop_gradient(ivy.sign(sumexp))
          out = ivy.add(ivy.log(ivy.abs(sumexp)), amax)
      if return_sign:
          return out, sign
  
      if b is not None:
          out = ivy.where(
              sign < 0, ivy.array(ivy.nan, dtype=out.dtype), out
          )
  
      return out.astype(out_dtype)
  
imports: import ivy
  from ivy.functional.frontends.jax.func_wrapper import to_ivy_arrays_and_back
  from ivy.func_wrapper import with_supported_dtypes
label_desc: Use image node_id 19 for calling a global function with example usage: logsumexp(a, axis, b, keepdims, return_sign) and returns: out, out,  sign