(self)
| 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): |