code: def execute(cls, ctx, op):
      inputs, device_id, xp = as_same_device(
          [ctx[inp.key] for inp in op.inputs],
          device=op.device,
          ret_extra=True,
      )
      a = inputs[0]
      if len(inputs) == 2:
          val = inputs[1]
      else:
          val = op.val
  
      with device(device_id):
          if not op.k:
              a = a.copy()
              xp.fill_diagonal(a, val, wrap=op.wrap)
          else:
              assert a.ndim == 2
              k = op.k or 0
              n_rows, n_cols = a.shape
              if k > 0:
                  n_cols -= k
              elif k < 0:
                  n_rows += k
              n = min(n_rows, n_cols)
  
              # generate indices
              rows, cols = np.diag_indices(n)
              if k > 0:
                  cols = cols.copy()
                  cols += k
              elif k < 0:
                  rows = rows.copy()
                  rows -= k
  
              a = a.copy()
              a[rows, cols] = val
  
          ctx[op.outputs[0].key] = a
  
imports: import numpy
  from ...None import opcodes
  from ...core import ENTITY_TYPE, recursive_tile
  from ...serialization.serializables import KeyField, AnyField, BoolField, Int32Field
  from ...utils import has_unknown_shape, ceildiv
  from ..operands import TensorOperand, TensorOperandMixin
  from ..datasource import tensor
  from ..array_utils import as_same_device, device
  from ..core import Tensor, TENSOR_TYPE
  from ..utils import decide_unify_split
label_desc: Use image node_id 16 for calling the TensorFillDiagonal obj's underlying member method code with example usage: obj.execute(cls, ctx, op) without return types