code: def _get_tensor_d_from_sampled_df(df):
      """
      Converts a sampled cuDF DataFrame into a list of tensors.
  
      Args:
          df (cudf.DataFrame): The sampled cuDF DataFrame containing columns
      Returns:
          dict: A dictionary of tensors, keyed by batch_id and hop_id.
      """
      range_d = _get_source_destination_range(df)
      df, renumber_map, renumber_map_batch_indices = _get_renumber_map(
          df
      )
      batch_id_tensor = cast_to_tensor(df["batch_id"])
      split_d, batch_indices = _create_split_dict(batch_id_tensor)
      batch_split_indices = torch.searchsorted(
          batch_id_tensor, batch_indices
      ).to("cpu")
  
      for column in df.columns:
          if column != "batch_id":
              t = cast_to_tensor(df[column])
              split_t = _split_tensor(t, batch_split_indices)
              for bid, batch_t in zip(split_d.keys(), split_t):
                  split_d[bid][column] = batch_t
  
      split_t = _split_tensor(renumber_map, renumber_map_batch_indices)
      for bid, batch_t in zip(split_d.keys(), split_t):
          split_d[bid]["map"] = batch_t
      del df
      result_tensor_d = {}
      # Cache hop_split_d, hop_indices
      hop_split_empty_d, hop_indices = None, None
      for batch_id, batch_d in split_d.items():
          hop_id_tensor = batch_d["hop_id"]
          if hop_split_empty_d is None:
              hop_split_empty_d, hop_indices = _create_split_dict(
                  hop_id_tensor
              )
  
          hop_split_d = {k: {} for k in hop_split_empty_d.keys()}
          hop_split_indices = torch.searchsorted(
              hop_id_tensor, hop_indices
          ).to("cpu")
          for column, t in batch_d.items():
              if column not in ["hop_id", "map"]:
                  split_t = _split_tensor(t, hop_split_indices)
                  for hid, ht in zip(hop_split_d.keys(), split_t):
                      hop_split_d[hid][column] = ht
          for hid in hop_split_d.keys():
              hop_split_d[hid]["sources_range"] = range_d[
                  (batch_id, hid)
              ]["sources_range"]
              hop_split_d[hid]["destinations_range"] = range_d[
                  (batch_id, hid)
              ]["destinations_range"]
  
          result_tensor_d[batch_id] = hop_split_d
          result_tensor_d[batch_id]["map"] = batch_d["map"]
      return result_tensor_d
  
imports: from __future__ import annotations
  from typing import List, Tuple, Dict, Optional
  from collections import defaultdict
  import cudf
  from cugraph.utilities.utils import import_optional
  from cugraph_dgl.nn import SparseGraph
label_desc: Use image node_id 6 for calling a global function with example usage: _get_tensor_d_from_sampled_df(df) and returns: result_tensor_d