code: def multilayer_sample(A, fanouts, seeds, ndata):
      sampled_matrices = []
      src = seeds
  
      #########################################################################
      # (HIGHLIGHT) Using the sparse sample operator to preform LADIES sampling
      # algorithm from the neighboring nodes of the seeds nodes.
      # The sparse sp_power operator is applied to compute sample probability,
      # and sp_broadcast_v is then employed to normalize weight by performing
      # division operations on column.
      #########################################################################
  
      for fanout in fanouts:
          # Sample neighbors.
          sub_A = A.index_select(1, src)
          # Compute probability weight.
          row_probs = (sub_A**2).sum(1)
          row_probs = row_probs / row_probs.sum(0)
          # Layer-wise sample nodes.
          row_ids = torch.multinomial(
              row_probs, fanout, replacement=False
          )
          # Add self-loop.
          row_ids = torch.cat((row_ids, src), 0).unique()
          sampled_matrix = sub_A.index_select(0, row_ids)
          # Normalize edge weights.
          div_matirx = sp_broadcast_v(
              sampled_matrix,
              row_probs[row_ids].reshape(-1, 1),
              "truediv",
          )
          div_matirx = sp_broadcast_v(
              div_matirx, div_matirx.sum(0), "truediv"
          )
  
          # Save the sampled matrix.
          sampled_matrices.insert(0, div_matirx)
          src = row_ids
  
      x = ndata["feat"][src]
      y = ndata["label"][seeds]
      return sampled_matrices, x, y
  
imports: import argparse
  import dgl.sparse
  import torch
  import torch.nn
  import torch.nn.functional
  import torchmetrics.functional
  from dgl.data import AsNodePredDataset
  from dgl.sparse import sp_broadcast_v
  from ogb.nodeproppred import DglNodePropPredDataset
label_desc: Use image node_id 1 for calling a global function with example usage: multilayer_sample(A, fanouts, seeds, ndata) and returns: sampled_matrices,  x,  y