code: def device_to_id(self, device_str=None):
      device_str = (
          self.torch_device if device_str is None else device_str
      )
      if device_str.lower() == "cpu":
          return -1
      elif device_str.lower() == "cuda":
          return 0
      elif device_str.lower().startswith("cuda:"):
          _, device_id = device_str.split(":")[1]
          device_id = int(device_id)
          return device_id
      else:
          warnings.warn(
              "Could not determine device ID - defaulting to -1"
          )
          return -1
  
imports: import warnings
label_desc: Use image node_id 3 for calling the TorchBase obj's underlying member method code with example usage: obj.device_to_id(device_str) and returns: unknown, int, device_id, unknown