

def check_backward(self, x_data, t_data, y_grad):
    x = chainer.Variable(x_data)
    t = chainer.Variable(gW)
    W = self.link.W
    y = self.link(x, t)
    y.grad = y_grad
    y.backward()
    negative_sampling.NegativeSamplingFunction.samples = y.creator.samples

    def f():
        return (self.link(x, t).data,)
    (gx, gW) = gradient_check.numerical_grad(f, (x.data, W.data), (y.grad,), eps=0.01)
    del negative_sampling.NegativeSamplingFunction.samples
    gradient_check.assert_allclose(cuda.to_cpu(gx), cuda.to_cpu(x.grad), atol=0.0001)
    gradient_check.assert_allclose(cuda.to_cpu(gW), cuda.to_cpu(W.grad), atol=0.0001)

dataset/ETHPy150Open pfnet/chainer/tests/chainer_tests/links_tests/loss_tests/test_negative_sampling.py TestNegativeSampling.check_backward/VarMisuse@31/41 `t_data`->`gW`