def testSimple(self): with self.assertRaises(TypeError): _ = gen_math_ops.Add(1., 1.) x = constant_op.constant(1) self.assertEqual([2], self.evaluate(gen_math_ops.Add(x=x, y=x)))
def testSimple(self): with self.assertRaisesRegexp(TypeError, "only takes keyword args"): _ = gen_math_ops.Add(1., 1.) x = constant_op.constant(1) self.assertEqual([2], self.evaluate(gen_math_ops.Add(x=x, y=x)))
def _tfr_control_flow_range_for(x): # TODO(fengliuai): use len(x) instead n = 10 x_sum = x[0] for i in range(1, n): x_sum = math_ops.Add(x_sum, x[i]) return x_sum
def _tfr_loc_test(x): n = 10 x_sum = x[0] for i in range(1, n): x_sum = math_ops.Add(x_sum, x[i]) return x_sum
def _tfr_tf_ops_tensors(x, y, pred): if pred: return math_ops.Add(x, y) else: return array_ops.Concat(0, [x, y])
def testName(self): x = constant_op.constant(1) op = gen_math_ops.Add(x=x, y=x, name="double") if not context.executing_eagerly(): # `Tensor.name` is not available in eager. self.assertEqual(op.name, "double:0")
def testRequiresKwargs_providesSuggestion(self): msg = "possible keys: \\['x', 'y', 'name'\\]" with self.assertRaisesRegex(TypeError, msg): gen_math_ops.Add(1., y=2.)
def testRequiresKwargs(self): with self.assertRaisesRegex(TypeError, "only takes keyword args"): gen_math_ops.Add(1., 1.)
def testSimple(self): x = constant_op.constant(1) self.assertEqual([2], self.evaluate(gen_math_ops.Add(x=x, y=x)))