code: def test_forward(self, backend_config):
      x_data = backend_config.get_array(self.x)
      t_data = backend_config.get_array(self.t)
      x = chainer.Variable(x_data)
      t = chainer.Variable(t_data, requires_grad=False)
  
      link = self.create_link()
      link.to_device(backend_config.device)
  
      y, samples = link(x, t, reduce=self.reduce, return_samples=True)
  
      self.assertEqual(y.shape, self.gy.shape)
  
      cpu_device = CpuDevice()
      W = cpu_device.send(link.W.data)
      samples = cpu_device.send(samples)
  
      loss = numpy.empty((len(self.x),), self.dtype)
      for i in range(len(self.x)):
          ix = self.x[i]
          it = self.t[i]
          if it == -1:
              loss[i] = 0
          else:
              w = W[samples[i]]
              f = w.dot(ix)
              # first one is positive example
              f[0] *= -1
              loss[i] = numpy.logaddexp(f, 0).sum()
  
      if self.reduce == "sum":
          loss = loss.sum()
  
      testing.assert_allclose(y.data, loss, **self.test_forward_options)
  
file_path: chainer/tests/chainer_tests/links_tests/loss_tests/test_negative_sampling.py
imports: import unittest
  import numpy
  import chainer
  from chainer import backend
  from chainer.backend import CpuDevice
  from chainer import links
  from chainer import testing
label_desc: Use image node_id 5 for calling the TestNegativeSampling obj's underlying member method code with example usage: obj.test_forward(backend_config) without return types