class_docstr: :class:`NegSampleDataLoader` is an abstract class which can sample negative examples by ratio.
  It has two neg-sampling method, the one is 1-by-1 neg-sampling (pair wise),
  and the other is 1-by-multi neg-sampling (point wise).
  
  Args:
      config (Config): The config of dataloader.
      dataset (Dataset): The dataset of dataloader.
      sampler (Sampler): The sampler of dataloader.
      shuffle (bool, optional): Whether the dataloader will be shuffle after a round. Defaults to ``False``.
class_docstr_tok: [":","class",":","`","NegSampleDataLoader","`","is","an","abstract","class","which","can","sample","negative","examples","by","ratio",".","It","has","two","neg-sampling","method",",","the","one","is","1-by-1","neg-sampling","(","pair","wise",")",",","and","the","other","is","1-by-multi","neg-sampling","(","point","wise",")",".","Args",":","config","(","Config",")",":","The","config","of","dataloader",".","dataset","(","Dataset",")",":","The","dataset","of","dataloader",".","sampler","(","Sampler",")",":","The","sampler","of","dataloader",".","shuffle","(","bool",",","optional",")",":","Whether","the","dataloader","will","be","shuffle","after","a","round",".","Defaults","to","``","False","``","."]
code: def _neg_sampling(self, inter_feat):
      if self.neg_sample_args.get("dynamic", False):
          candidate_num = self.neg_sample_args["candidate_num"]
          user_ids = inter_feat[self.uid_field].numpy()
          item_ids = inter_feat[self.iid_field].numpy()
          neg_candidate_ids = self._sampler.sample_by_user_ids(
              user_ids, item_ids, self.neg_sample_num * candidate_num
          )
          self.model.eval()
          interaction = copy.deepcopy(inter_feat).to(self.model.device)
          interaction = interaction.repeat(
              self.neg_sample_num * candidate_num
          )
          neg_item_feat = Interaction(
              {self.iid_field: neg_candidate_ids.to(self.model.device)}
          )
          interaction.update(neg_item_feat)
          scores = self.model.predict(interaction).reshape(
              candidate_num, -1
          )
          indices = torch.max(scores, dim=0)[1].detach()
          neg_candidate_ids = neg_candidate_ids.reshape(
              candidate_num, -1
          )
          neg_item_ids = neg_candidate_ids[
              indices, [i for i in range(neg_candidate_ids.shape[1])]
          ].view(-1)
          self.model.train()
          return self.sampling_func(inter_feat, neg_item_ids)
      elif (
          self.neg_sample_args["distribution"] != "none"
          and self.neg_sample_args["sample_num"] != "none"
      ):
          user_ids = inter_feat[self.uid_field].numpy()
          item_ids = inter_feat[self.iid_field].numpy()
          neg_item_ids = self._sampler.sample_by_user_ids(
              user_ids, item_ids, self.neg_sample_num
          )
          return self.sampling_func(inter_feat, neg_item_ids)
      else:
          return inter_feat
  
imports: import math
  import copy
  from logging import getLogger
  import torch
  from recbole.data.interaction import Interaction
  from recbole.utils import InputType, FeatureType, FeatureSource, ModelType
  from recbole.data.transform import construct_transform
label_desc: Use image node_id 3 for calling the NegSampleDataLoader obj's underlying member method code with example usage: obj._neg_sampling(inter_feat) and returns: self, self, inter_feat