def test_multiply_by_scalar_with_float_and_float(self): self.assertEqual( reference_executor.multiply_by_scalar( reference_executor.ComputedValue(10.0, tf.float32), 0.5).value, 5.0) self.assertAlmostEqual( reference_executor.multiply_by_scalar( reference_executor.ComputedValue(np.float32(1.0), tf.float32), 0.333333333333).value, 0.3333333, places=3)
def test_multiply_by_scalar_with_tuple_and_float(self): self.assertEqual( str( reference_executor.multiply_by_scalar( reference_executor.ComputedValue( anonymous_tuple.AnonymousTuple([ ('A', 10.0), ('B', anonymous_tuple.AnonymousTuple([('C', 20.0)])), ]), [('A', tf.float32), ('B', [('C', tf.float32)])]), 0.5).value), '<A=5.0,B=<C=10.0>>')