class_docstr: The base class for class BaseModel,
  designed to implement some basic functionality of BaseModel.
  --  Designed by ZiXin Sun
class_docstr_tok: ["The","base","class","for","class","BaseModel",",","designed","to","implement","some","basic","functionality","of","BaseModel",".","--","Designed","by","ZiXin","Sun"]
code: def __formulate_device(
      cls, device: _typing.Union[str, torch.device] = ...
  ) -> torch.device:
      if type(device) == torch.device or (
          type(device) == str and device.strip().lower() != "auto"
      ):
          return torch.device(device)
      elif torch.cuda.is_available() and torch.cuda.device_count() > 0:
          return torch.device("cuda")
      else:
          return torch.device("cpu")
  
imports: import copy
  import logging
  import typing
  import torch
  import torch.nn.functional
  from copy import deepcopy
  from autogl.module.hpo.auto_module import AutoModule
label_desc: Use image node_id 1 for calling the _BaseBaseModel obj's underlying member method code with example usage: obj.__formulate_device(cls, device) and returns: torch, torch, torch