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

Method _cast

tensorflow/python/kernel_tests/cast_op_test.py:57–60  ·  view source on GitHub ↗
(self, x, dtype, use_gpu=False)

Source from the content-addressed store, hash-verified

55 return None
56
57 def _cast(self, x, dtype, use_gpu=False):
58 with self.cached_session(use_gpu=use_gpu):
59 val = constant_op.constant(x, self._toDataType(np.array([x]).dtype))
60 return math_ops.cast(val, self._toDataType(dtype), name="cast").eval()
61
62 def _test(self, x, dtype, use_gpu=False):
63 """Tests cast(x) to dtype behaves the same as numpy.astype."""

Callers 3

_testMethod · 0.95
_compareMethod · 0.95
testInfNanMethod · 0.95

Calls 5

_toDataTypeMethod · 0.95
cached_sessionMethod · 0.45
constantMethod · 0.45
evalMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected