Explicitly qualify references to CPU. (#11819)
Summary:
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11819
Differential Revision: D9928730
Pulled By: ezyang
fbshipit-source-id: 3140b6ef168586558f04fa8ee90f6f2169605d7d
diff --git a/caffe2/core/tensor_impl.h b/caffe2/core/tensor_impl.h
index 3f42ed3..b4fc3e7 100644
--- a/caffe2/core/tensor_impl.h
+++ b/caffe2/core/tensor_impl.h
@@ -152,17 +152,17 @@
if (size() > 0) {
if (data_type_.copy()) {
CAFFE_ENFORCE(
- GetDeviceType() == CPU,
+ GetDeviceType() == ::at::DeviceType::CPU,
"In CopyFrom source and dest tensors must both be CPU for meta copy");
CAFFE_ENFORCE(
- src.GetDeviceType() == CPU,
+ src.GetDeviceType() == ::at::DeviceType::CPU,
"In CopyFrom source and dest tensors must both be CPU for meta copy");
data_type_.copy()(src.raw_data(), raw_mutable_data(), size());
} else {
// We'll need to use a non-CPU context to perform the copy if
// one of the context is not CPU since only non-CPU context
// knows how to copy between CPU and that context
- if (src.GetDeviceType() != CPU || GetDeviceType() == CPU) {
+ if (src.GetDeviceType() != ::at::DeviceType::CPU || GetDeviceType() == ::at::DeviceType::CPU) {
if (!context) {
src.CreateContext()->CopyBytesToDevice(
nbytes(), src.raw_data(), raw_mutable_data(), GetDeviceType());