Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions torch/csrc/Storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,15 @@
#include <torch/csrc/copy_utils.h>
#include <torch/csrc/DynamicTypes.h>

#ifdef USE_CUDA
#include <THC/THCStorage.hpp>
#endif

#include <torch/csrc/generic/Storage.cpp>
#include <TH/THGenerateAllTypes.h>

#include <torch/csrc/generic/Storage.cpp>
#include <TH/THGenerateHalfType.h>

// NB: If you ever divest libtorch of USE_CUDA, you'll have to virtualize
// the CUDA call.
template<>
void THPPointer<THStorage>::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
}
THStorage_free(ptr);
}
}