(self)
| 86 | |
| 87 | @unittest.skip('skip this test to avoid debug logging.') |
| 88 | def test_device_placement_tf_gpu(self): |
| 89 | # import tensorflow must be imported after torch is imported when using tf1.15 |
| 90 | import tensorflow as tf # isort:skip |
| 91 | tf.debugging.set_log_device_placement(True) |
| 92 | with device_placement(Frameworks.tf, 'gpu:0'): |
| 93 | a = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) |
| 94 | b = tf.constant([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]) |
| 95 | c = tf.matmul(a, b) |
| 96 | s = tf.Session() |
| 97 | s.run(c) |
| 98 | tf.debugging.set_log_device_placement(False) |
| 99 | |
| 100 | def test_device_placement_torch_gpu(self): |
| 101 | with device_placement(Frameworks.torch, 'gpu:0'): |
nothing calls this directly
no test coverage detected