code: def __init__(self, sampler, sample_size, reduce="sum"):
      if reduce not in ("sum", "no"):
          raise ValueError(
              "only 'sum' and 'no' are valid for 'reduce', but '%s' "
              "is given" % reduce
          )
  
      self.sampler = sampler
      self.sample_size = sample_size
      self.reduce = reduce
      self.wx = None
  
imports: import numpy
  import six
  import chainer
  from chainer import backend
  from chainer.backends import cuda
  from chainer import function_node
  from chainer import utils
  from chainer.utils import argument
  from chainer.utils import precision
  from chainer.utils import type_check
label_desc: Use image node_id 1 to create a new NegativeSamplingFunction object from inherited base classes: function_node with example: obj = NegativeSamplingFunction(sampler, sample_size, reduce)