class_docstr: A composite data class for data structure in the graphbolt.
  
  It is designed to facilitate the exchange of data among different components
  involved in processing data. The purpose of this class is to unify the
  representation of input and output data across different stages, ensuring
  consistency and ease of use throughout the loading process.
class_docstr_tok: ["A","composite","data","class","for","data","structure","in","the","graphbolt",".","It","is","designed","to","facilitate","the","exchange","of","data","among","different","components","involved","in","processing","data",".","The","purpose","of","this","class","is","to","unify","the","representation","of","input","and","output","data","across","different","stages",",","ensuring","consistency","and","ease","of","use","throughout","the","loading","process","."]
docstr: `negative_node_pairs` is a representation of negative graphs used for
  evaluating or computing loss in link prediction tasks.
  - If `negative_node_pairs` is a tuple: It indicates a homogeneous graph
  containing two tensors representing source-destination node pairs.
  - If `negative_node_pairs` is a dictionary: The keys should be edge type,
  and the value should be a tuple of tensors representing node pairs of the
  given type.
docstr_tok: ["`","negative_node_pairs","`","is","a","representation","of","negative","graphs","used","for","evaluating","or","computing","loss","in","link","prediction","tasks",".","-","If","`","negative_node_pairs","`","is","a","tuple",":","It","indicates","a","homogeneous","graph","containing","two","tensors","representing","source-destination","node","pairs",".","-","If","`","negative_node_pairs","`","is","a","dictionary",":","The","keys","should","be","edge","type",",","and","the","value","should","be","a","tuple","of","tensors","representing","node","pairs","of","the","given","type","."]
code: def negative_node_pairs(self):
      """`negative_node_pairs` is a representation of negative graphs used for
      evaluating or computing loss in link prediction tasks.
      - If `negative_node_pairs` is a tuple: It indicates a homogeneous graph
      containing two tensors representing source-destination node pairs.
      - If `negative_node_pairs` is a dictionary: The keys should be edge type,
      and the value should be a tuple of tensors representing node pairs of the
      given type.
      """
      # Build negative graph.
      if (
          self.compacted_negative_srcs is not None
          and self.compacted_negative_dsts is not None
      ):
          # For homogeneous graph.
          if isinstance(self.compacted_negative_srcs, torch.Tensor):
              negative_node_pairs = (
                  self.compacted_negative_srcs,
                  self.compacted_negative_dsts,
              )
          # For heterogeneous graph.
          else:
              negative_node_pairs = {
                  etype: (
                      neg_src,
                      self.compacted_negative_dsts[etype],
                  )
                  for etype, neg_src in self.compacted_negative_srcs.items()
              }
      elif (
          self.compacted_negative_srcs is not None
          and self.compacted_node_pairs is not None
      ):
          # For homogeneous graph.
          if isinstance(self.compacted_negative_srcs, torch.Tensor):
              negative_ratio = self.compacted_negative_srcs.size(1)
              negative_node_pairs = (
                  self.compacted_negative_srcs,
                  self.compacted_node_pairs[1]
                  .repeat_interleave(negative_ratio)
                  .view(-1, negative_ratio),
              )
          # For heterogeneous graph.
          else:
              negative_ratio = list(
                  self.compacted_negative_srcs.values()
              )[0].size(1)
              negative_node_pairs = {
                  etype: (
                      neg_src,
                      self.compacted_node_pairs[etype][1]
                      .repeat_interleave(negative_ratio)
                      .view(-1, negative_ratio),
                  )
                  for etype, neg_src in self.compacted_negative_srcs.items()
              }
      elif (
          self.compacted_negative_dsts is not None
          and self.compacted_node_pairs is not None
      ):
          # For homogeneous graph.
          if isinstance(self.compacted_negative_dsts, torch.Tensor):
              negative_ratio = self.compacted_negative_dsts.size(1)
              negative_node_pairs = (
                  self.compacted_node_pairs[0]
                  .repeat_interleave(negative_ratio)
                  .view(-1, negative_ratio),
                  self.compacted_negative_dsts,
              )
          # For heterogeneous graph.
          else:
              negative_ratio = list(
                  self.compacted_negative_dsts.values()
              )[0].size(1)
              negative_node_pairs = {
                  etype: (
                      self.compacted_node_pairs[etype][0]
                      .repeat_interleave(negative_ratio)
                      .view(-1, negative_ratio),
                      neg_dst,
                  )
                  for etype, neg_dst in self.compacted_negative_dsts.items()
              }
      else:
          negative_node_pairs = None
      return negative_node_pairs
  
imports: from dataclasses import dataclass
  from typing import Dict, List, Tuple, Union
  import torch
  import dgl
  from dgl.utils import recursive_apply
  from .base import etype_str_to_tuple
  from .internal import get_attributes
  from .sampled_subgraph import SampledSubgraph
label_desc: Use image node_id 9 for calling the MiniBatch obj's underlying member method code with example usage: obj.negative_node_pairs() and returns: negative_node_pairs