code: def _sample_neg(triplets: np.ndarray, num_nodes: int) -> Tuple[TT, TT]:  # type: ignore
      _, torch, _, _, _, _, _, _ = lazy_embed_import_dep()
      triplets = torch.tensor(triplets)
      h, r, t = triplets.T
      h_o_t = torch.randint(high=2, size=h.size())
  
      random_h = torch.randint(high=num_nodes, size=h.size())
      random_t = torch.randint(high=num_nodes, size=h.size())
  
      neg_h = torch.where(h_o_t == 0, random_h, h)
      neg_t = torch.where(h_o_t == 1, random_t, t)
      neg_triplets = torch.stack((neg_h, r, neg_t), dim=1)
  
      all_triplets = torch.cat((triplets, neg_triplets), dim=0)
      labels = torch.zeros((all_triplets.size()[0]))
      labels[: triplets.shape[0]] = 1
      return all_triplets, labels
  
imports: import logging
  import numpy
  import pandas
  from typing import Optional, Union, Callable, List, TYPE_CHECKING, Any, Tuple
  from .PlotterBase import Plottable
  from .compute.ComputeMixin import ComputeMixin
label_desc: Use image node_id 4 for calling the SubgraphIterator obj's underlying member method code with example usage: obj._sample_neg(triplets, num_nodes) and returns: all_triplets,  labels