MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / testRounding

Method testRounding

tensorflow/python/ops/math_ops_test.py:190–199  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

188
189 @test_util.run_in_graph_and_eager_modes
190 def testRounding(self):
191 x = np.arange(-5.0, 5.0, .25)
192 for dtype in [np.float32, np.double, np.int32]:
193 x_np = np.array(x, dtype=dtype)
194 with test_util.device(use_gpu=True):
195 x_tf = constant_op.constant(x_np, shape=x_np.shape)
196 y_tf = math_ops.round(x_tf)
197 y_tf_np = self.evaluate(y_tf)
198 y_np = np.round(x_np)
199 self.assertAllClose(y_tf_np, y_np, atol=1e-2)
200
201
202class ModTest(test_util.TensorFlowTestCase):

Callers

nothing calls this directly

Calls 4

deviceMethod · 0.45
constantMethod · 0.45
evaluateMethod · 0.45
assertAllCloseMethod · 0.45

Tested by

no test coverage detected