def test_grad(self): with self.test_session(): shape = (5, ) x = tf.constant([5, 4, 3, 2, 1], dtype=tf.float32) y = gen_zero_out_op_2.zero_out(x) err = gradient_checker.ComputeGradientError(x, shape, y, shape) self.assertLess(err, 1e-4)
def test_grad(self): with self.test_session(): shape = (5,) x = tf.constant([5, 4, 3, 2, 1], dtype=tf.float32) y = gen_zero_out_op_2.zero_out(x) err = gradient_checker.ComputeGradientError(x, shape, y, shape) self.assertLess(err, 1e-4)
def test(self): with self.test_session(): result = gen_zero_out_op_2.zero_out([5, 4, 3, 2, 1]) self.assertAllEqual(result.eval(), [5, 0, 0, 0, 0])