Delete TensorImpl::GetDevice() (#20025)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/20025
Delete TensorImpl::GetDevice() and clean all its call sites.
Reviewed By: ezyang
Differential Revision: D15170917
fbshipit-source-id: b6862b74aa036198544f79d18a8c0f995cb0ca7b
diff --git a/c10/core/TensorImpl.h b/c10/core/TensorImpl.h
index 3a80a79..907834c 100644
--- a/c10/core/TensorImpl.h
+++ b/c10/core/TensorImpl.h
@@ -972,15 +972,6 @@
}
/**
- * The device of a Tensor; e.g., Device(kCUDA, 1) (the 1-index CUDA
- * device).
- */
- Device GetDevice() const {
- // See NOTE [c10::optional operator usage in CUDA]
- return *device_opt_;
- }
-
- /**
* @brief Extends the outer-most dimension of this tensor by num elements,
* preserving the existing data.
*
diff --git a/caffe2/core/tensor.h b/caffe2/core/tensor.h
index 152fae8..f65e771 100644
--- a/caffe2/core/tensor.h
+++ b/caffe2/core/tensor.h
@@ -172,7 +172,7 @@
}
at::Device GetDevice() const {
- return impl_.get()->GetDevice();
+ return impl_.get()->device();
}
/**