MCPcopy Create free account
hub / github.com/modelscope/modelscope / test_device_placement_tf_gpu

Method test_device_placement_tf_gpu

tests/utils/test_device.py:88–98  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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'):

Callers

nothing calls this directly

Calls 2

device_placementFunction · 0.90
runMethod · 0.45

Tested by

no test coverage detected