code: def make_sampler(backend_config, high):
      # To fix samples, use fixed samples.
      def sampler(shape):
          s = numpy.arange(numpy.prod(shape)) % high
          s = s.reshape(shape).astype(numpy.int32)
          return backend_config.get_array(s)
  
      return sampler
  
imports: import unittest
  import numpy
  import pytest
  import six
  import chainer
  from chainer.backend import CpuDevice
  from chainer.backends import cuda
  from chainer import functions
  from chainer.functions.loss import negative_sampling
  from chainer import gradient_check
  from chainer import testing
  from chainer.testing import attr
label_desc: Use image node_id 1 for calling a global function with example usage: make_sampler(backend_config, high) and returns: sampler, backend_config