#define __STDC_FORMAT_MACROS #include "torch/csrc/python_headers.h" #ifdef _MSC_VER #include #endif #include #define THP_HOST_HALF #include #include // See Note [TH abstraction violation] // - Used to get at the allocator associated with a storage #include #include #include #include "THP.h" #include "copy_utils.h" #include "DynamicTypes.h" #ifdef USE_CUDA #include #endif #include "generic/Storage.cpp" #include #include "generic/Storage.cpp" #include // NB: If you ever divest libtorch of USE_CUDA, you'll have to virtualize // the CUDA call. template<> void THPPointer::free() { if (ptr) { if (ptr->data_ptr.device().is_cpu()) { THStorage_free(ptr); } else { AT_ASSERT(ptr->data_ptr.device().is_cuda()); #ifdef USE_CUDA THStorage_free(ptr); #else AT_ERROR("Cannot free THCStorage when not built with CUDA"); #endif } } }