Merge pull request #2939 from reyoung/feature/refine_tensor_hpp

Tensor should use PADDLE_ONLY_CPU macro
cblas_new
Yu Yang 8 years ago committed by GitHub
commit b90780c3a8

@ -71,14 +71,14 @@ class Tensor {
holder_.reset(new PlaceholderImpl<T, platform::CPUPlace>( holder_.reset(new PlaceholderImpl<T, platform::CPUPlace>(
boost::get<platform::CPUPlace>(place), product(dims_) * sizeof(T))); boost::get<platform::CPUPlace>(place), product(dims_) * sizeof(T)));
} else if (platform::is_gpu_place(place)) { } else if (platform::is_gpu_place(place)) {
#ifdef __CUDACC__ #ifdef PADDLE_ONLY_CPU
PADDLE_THROW("'GPUPlace' is not supported in CPU only device.");
#else
holder_.reset(new PlaceholderImpl<T, platform::GPUPlace>( holder_.reset(new PlaceholderImpl<T, platform::GPUPlace>(
boost::get<platform::GPUPlace>(place), product(dims_) * sizeof(T))); boost::get<platform::GPUPlace>(place), product(dims_) * sizeof(T)));
#else
PADDLE_ENFORCE(true, "'GPUPlace' is not supported in CPU only device.");
#endif #endif
} else { } else {
PADDLE_ENFORCE(true, "Unknown 'place'."); PADDLE_THROW("Unknown 'place'.");
} }
offset_ = 0; offset_ = 0;
} }

Loading…
Cancel
Save