code: def diagonal(A, *, offset=0, dim1=-2, dim2=-1):
      return torch_frontend.diagonal(
          A, offset=offset, dim1=dim1, dim2=dim2
      )
  
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 6 for calling a global function with example usage: diagonal(A) and returns: torch_frontend