code: def get_device_from_value(value: _C.Value) -> Optional[torch.device]:
      if not _is_tensor(value):
          return None
      tensor_type = typing.cast(_C.TensorType, value.type())
      return tensor_type.device()
  
imports: from __future__ import annotations
  import dataclasses
  import re
  import typing
  from typing import Any, Dict, Iterable, Optional, Sequence, Tuple, Union
  import torch
  from torch import _C
  from torch._C import _onnx
  from torch.onnx._globals import GLOBALS
  from torch.onnx._internal import _beartype, registration
label_desc: Use image node_id 10 for calling a global function with example usage: get_device_from_value(value) and returns: tensor_type, None