code: def run(self):
      while True:
          input_npy = np.zeros(
              self._batch_size,
              dtype=[
                  ("user_id_input", np.int32),
                  ("p_item_id_input", np.int32),
                  ("n_item_id_input", np.int32),
              ],
          )
  
          if self._state + self._batch_size >= len(self._dataset.data):
              if not self._chronological:
                  self._state = 0
                  self._dataset.shuffle()
              else:
                  break
  
          for sample_itr, entry in enumerate(
              self._dataset.data[
                  self._state : (self._state + self._batch_size)
              ]
          ):
              neg_id = int(
                  random.random() * (self._dataset.max_item() - 1)
              )
              while (
                  neg_id
                  in self._dataset.get_interactions_by_user_gb_item(
                      entry["user_id"]
                  )
              ):
                  neg_id = int(
                      random.random() * (self._dataset.max_item() - 1)
                  )
              input_npy[sample_itr] = (
                  entry["user_id"],
                  entry["item_id"],
                  neg_id,
              )
  
          self._state += self._batch_size
          self._q.put(input_npy, block=True)
  
file_path: openrec/openrec/tf1/legacy/utils/samplers/pairwise_sampler.py
imports: from __future__ import print_function
  import numpy
  import random
  from multiprocessing import Process
  from openrec.tf1.legacy.utils.samplers import Sampler
label_desc: Use image node_id 2 for calling the _PairwiseSampler obj's underlying member method code with example usage: obj.run() without return types