code: def diagonal_scatter(input, src, offset=0, dim1=0, dim2=1):
      input = ivy.copy_array(input)
      input_shape = input.shape
      indices = ivy.arange(0, input.size)
      diagonal_indices = ivy.diagonal(
          indices.reshape(input.shape),
          offset=offset,
          axis1=dim1,
          axis2=dim2,
      )
      if src.shape != diagonal_indices.shape:
          raise ivy.utils.exceptions.IvyException(
              "src must have shape equal to specified diagonal of input. src size ="
              f" {src.shape}, diagonal size = {diagonal_indices.shape}"
          )
      input = input.reshape((-1,))
      input[diagonal_indices.reshape((-1,))] = src.reshape((-1,))
      input = input.reshape(input_shape)
      return input
  
imports: import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape
  import ivy.functional.frontends.torch
label_desc: Use image node_id 8 for calling a global function with example usage: diagonal_scatter(input, src, offset, dim1, dim2) and returns: input