code: def inv_ex(A, *, check_errors=False, out=None):
      if ivy.any(ivy.det(A) == 0):
          if check_errors:
              raise RuntimeError("Singular Matrix")
          else:
              inv = A * math.nan
              # TODO: info should return an array containing the diagonal element of the
              # LU decomposition of the input matrix that is exactly zero
              info = ivy.ones(A.shape[:-2], dtype=ivy.int32)
      else:
          inv = ivy.inv(A, out=out)
          info = ivy.zeros(A.shape[:-2], dtype=ivy.int32)
      return inv, info
  
imports: import math
  import ivy
  import ivy.functional.frontends.torch
  from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back
  from ivy.func_wrapper import with_supported_dtypes, with_unsupported_dtypes
  from collections import namedtuple
label_desc: Use image node_id 13 for calling a global function with example usage: inv_ex(A) and returns: inv,  info