code: def _ensure_hashable(x: Union[list, tuple, dict, Tensor]):
      """Return a version of x that is hashable."""
      if isinstance(x, (list, tuple)):
          return tuple(_ensure_hashable(y) for y in x)
  
      if isinstance(x, dict):
          return tuple(
              (_ensure_hashable(k), _ensure_hashable(v))
              for k, v in x.items()
          )
  
      if isinstance(x, Tensor):
          return hash(x)
  
      assert hash(x) is not None
      return x
  
file_path: NeuralCompression/projects/torch_vct/utils/memoize.py
imports: import collections
  import functools
  from typing import Callable, Optional, Tuple, TypeVar, Union
  from torch import Tensor
label_desc: Use image node_id 2 for calling a global function with example usage: _ensure_hashable(x) and returns: x, tuple, tuple, hash