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

Method testTensorPlacement

tensorflow/python/eager/core_test.py:498–506  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

496
497 @test_util.run_gpu_only
498 def testTensorPlacement(self):
499 x = constant_op.constant(1.).gpu()
500 with context.device('gpu:0'):
501 y = constant_op.constant(2.)
502 # Add would fail if t2 were not on GPU
503 result = execute(
504 b'Add', 1, inputs=[x, y],
505 attrs=('T', x.dtype.as_datatype_enum))[0].cpu().numpy()
506 self.assertEqual(3, result)
507
508 @test_util.run_gpu_only
509 def testResourceTensorPlacement(self):

Callers

nothing calls this directly

Calls 6

cpuMethod · 0.80
executeFunction · 0.70
gpuMethod · 0.45
constantMethod · 0.45
deviceMethod · 0.45
numpyMethod · 0.45

Tested by

no test coverage detected