code: def get_device(obj: Union[torch.Tensor, nn.Module]):
      if isinstance(obj, torch.Tensor):
          return obj.device
      return next(obj.parameters()).device
  
file_path: optimum/optimum/gptq/utils.py
imports: from logging import getLogger
  from typing import Optional, Union
  import torch
  from torch import nn
  from transformers.pytorch_utils import Conv1D
  from .constants import BLOCK_PATTERNS, SEQLEN_KEYS_TRANFORMERS
label_desc: Use image node_id 4 for calling a global function with example usage: get_device(obj) and returns: next, obj