code: def test_torch_device_scope(self):
      import torch
  
      if not torch.cuda.device_count():
          self.skipTest("Need at least one GPU for testing")
  
      with backend.device_scope("cpu:0"):
          t = backend.numpy.ones((2, 1))
          self.assertEqual(t.device, torch.device("cpu"))
      with backend.device_scope("CPU:0"):
          t = backend.numpy.ones((2, 1))
          self.assertEqual(t.device, torch.device("cpu"))
  
      # When leaving the scope, the device should be back with gpu:0
      t = backend.numpy.ones((2, 1))
      self.assertEqual(t.device, torch.device("cuda", 0))
  
      # Also verify the explicit gpu -> cuda conversion
      with backend.device_scope("gpu:0"):
          t = backend.numpy.ones((2, 1))
          self.assertEqual(t.device, torch.device("cuda", 0))
  
file_path: keras/keras/backend/tests/device_scope_test.py
imports: import pytest
  from keras import backend
  from keras import testing
label_desc: Use image node_id 4 for calling the DeviceTest obj's underlying member method code with example usage: obj.test_torch_device_scope() without return types