Eliminate the use of Type. (#17804)
authorjainkunal3004 <jainkunal3004@devvm257.prn3.facebook.com>
Tue, 12 Mar 2019 19:50:29 +0000 (12:50 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 12 Mar 2019 19:54:24 +0000 (12:54 -0700)
Summary:
Stack:
&nbsp;&nbsp;&nbsp;&nbsp;:black_circle:&nbsp; **#17804 Eliminate the use of Type.**&nbsp;&nbsp;[: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

aten/src/ATen/ScalarOps.h

index 70f6163..c74ed0c 100644 (file)
@@ -10,10 +10,10 @@ namespace c10 {
 // 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));
   }
 }