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

Method testSoftPlacement

tensorflow/python/eager/ops_test.py:296–310  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

294
295 @test_util.run_gpu_only
296 def testSoftPlacement(self):
297 # Temporarily replace the context
298 # pylint: disable=protected-access
299 old_context = context.context()
300 context._set_context(context.Context())
301 try:
302 config.set_device_policy('silent')
303 config.set_soft_device_placement(True)
304 cpu_tensor = constant_op.constant(1.0)
305 result = cpu_tensor + cpu_tensor
306 self.assertEqual(result.device,
307 '/job:localhost/replica:0/task:0/device:GPU:0')
308 finally:
309 context._set_context(old_context)
310 # pylint: enable=protected-access
311
312 def testRandomUniform(self):
313 scalar_shape = constant_op.constant([], dtype=dtypes.int32)

Callers

nothing calls this directly

Calls 3

contextMethod · 0.45
ContextMethod · 0.45
constantMethod · 0.45

Tested by

no test coverage detected