Summary:
Stack:
:black_circle: **#17804 Eliminate the use of Type.** [:yellow_heart:](https://our.intern.facebook.com/intern/diff/
D14382165/)
at::CPU produces Type object which is then casted into TensorOptions, instead directly using TensorOptions.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17804
Differential Revision:
D14407851
Pulled By: ezyang
fbshipit-source-id:
6462d698305b7c24382c1bfd440d3227bd28d9e4
// to implement this without going through Derived Types (which are not part of core).
inline at::Tensor scalar_to_tensor(Scalar s) {
if (s.isFloatingPoint()) {
- return at::scalar_tensor(s, at::CPU(kDouble).options());
+ return at::scalar_tensor(s, at::device(at::kCPU).dtype(at::kDouble));
} else {
AT_ASSERT(s.isIntegral());
- return at::scalar_tensor(s, at::CPU(kLong).options());
+ return at::scalar_tensor(s, at::device(at::kCPU).dtype(at::kLong));
}
}