code: def diag_indices(n, ndim=2):
      idx = ivy.arange(n)
      res = ivy.array((idx,) * ndim)
      res = tuple(res.astype("int64"))
      return res
  
file_path: ivy/ivy/functional/frontends/numpy/indexing_routines/generating_index_arrays.py
imports: import inspect
  import ivy
  from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
label_desc: Use image node_id 1 for calling a global function with example usage: diag_indices(n, ndim) and returns: res