code: def fill_diag(
      src: SparseTensor, fill_value: float, k: int = 0
  ) -> SparseTensor:
      num_diag = min(src.sparse_size(0), src.sparse_size(1) - k)
      if k < 0:
          num_diag = min(src.sparse_size(0) + k, src.sparse_size(1))
  
      value = src.storage.value()
      if value is not None:
          sizes = [num_diag] + src.sizes()[2:]
          return set_diag(src, value.new_full(sizes, fill_value), k)
      else:
          return set_diag(src, None, k)
  
file_path: pytorch_sparse/torch_sparse/diag.py
imports: from typing import Optional
  import torch
  from torch import Tensor
  from torch_sparse.storage import SparseStorage
  from torch_sparse.tensor import SparseTensor
label_desc: Use image node_id 3 for calling a global function with example usage: fill_diag(src, fill_value, k) and returns: set_diag, set_diag