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

Method testBfloat16

tensorflow/python/kernel_tests/cast_op_test.py:109–116  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

107 ]))
108
109 def testBfloat16(self):
110 a = np.random.uniform(-100, 100, 100).astype(np.float32)
111 with self.cached_session(use_gpu=False):
112 b = math_ops.cast(math_ops.cast(a, dtypes.bfloat16), dtypes.float32)
113 self.assertAllClose(a, self.evaluate(b), rtol=1 / 128.)
114 with self.cached_session(use_gpu=True):
115 b = math_ops.cast(math_ops.cast(a, dtypes.bfloat16), dtypes.float32)
116 self.assertAllClose(a, self.evaluate(b), rtol=1 / 128.)
117
118 @test_util.run_deprecated_v1
119 def testRandom(self):

Callers

nothing calls this directly

Calls 5

uniformMethod · 0.80
cached_sessionMethod · 0.45
castMethod · 0.45
assertAllCloseMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected