code: def test_on_gpu_when_requested():
      # we can't easily capture this
      tf.debugging.set_log_device_placement(True)
  
      # check we can execute something on it
      a = tf.constant(
          [1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name="a"
      )
      b = tf.constant(
          [1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name="b"
      )
      c = tf.matmul(a, b)
  
      assert c.numpy().shape == (2, 2)
  
      assert tf.config.list_physical_devices("GPU")
  
imports: import os
  import tensorflow
  import pytest
  from .None import require_gpu
label_desc: Use image node_id 1 for calling a global function with example usage: test_on_gpu_when_requested() without return types