code: def _safe_torch_tensor_loads(bs: bytes) -> t.Any:
      import torch
  
      f = io.BytesIO(bs)
      if not torch.cuda.is_available():
          return torch.load(f, map_location="cpu")
      else:
          return torch.load(f)
  
file_path: BentoML/src/bentoml/_internal/utils/pickle.py
imports: from __future__ import annotations
  import io
  import pickle
  import typing
label_desc: Use image node_id 3 for calling a global function with example usage: _safe_torch_tensor_loads(bs) and returns: torch, torch