code: def swig_ptr_from_HalfTensor(x):
      """gets a Faiss SWIG pointer from a pytorch tensor (on CPU or GPU)"""
      assert x.is_contiguous()
      assert x.dtype == torch.float16
      # no canonical half type in C/C++
      return faiss.cast_integer_to_void_ptr(
          x.storage().data_ptr() + x.storage_offset() * 2
      )
  
file_path: faiss/contrib/torch_utils.py
imports: import faiss
  import torch
  import contextlib
  import inspect
  import sys
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: swig_ptr_from_HalfTensor(x) and returns: faiss