summaryrefslogtreecommitdiff
path: root/torch
diff options
context:
space:
mode:
authorPeter Goldsborough <peter@goldsborough.me>2018-06-19 12:40:58 -0700
committerGitHub <noreply@github.com>2018-06-19 12:40:58 -0700
commita2dd7070318373aaaf9603a7ac2562742efaa044 (patch)
tree60ba94387ff4ce841e591d3dbce645d4ba21a99b /torch
parent7ccecbbb4e3217e69f33a151f46253762952ae07 (diff)
downloadpytorch-a2dd7070318373aaaf9603a7ac2562742efaa044.tar.gz
pytorch-a2dd7070318373aaaf9603a7ac2562742efaa044.tar.bz2
pytorch-a2dd7070318373aaaf9603a7ac2562742efaa044.zip
[C++ API] Create fixed width dtypes in torch:: namespace (#8639)
* Create fixed width dtypes in torch:: namespace * Make kByte -> kUInt8
Diffstat (limited to 'torch')
-rw-r--r--torch/csrc/api/include/torch/tensor.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/torch/csrc/api/include/torch/tensor.h b/torch/csrc/api/include/torch/tensor.h
index 69fd0612dd..63386a8c13 100644
--- a/torch/csrc/api/include/torch/tensor.h
+++ b/torch/csrc/api/include/torch/tensor.h
@@ -7,4 +7,23 @@
namespace torch {
// TODO: Rename to `Tensor`.
using Variable = autograd::Variable;
+
+/// Fixed width dtypes.
+constexpr auto kUInt8 = at::kByte;
+constexpr auto kInt8 = at::kChar;
+constexpr auto kInt16 = at::kShort;
+constexpr auto kInt32 = at::kInt;
+constexpr auto kInt64 = at::kLong;
+constexpr auto kFloat32 = at::kFloat;
+constexpr auto kFloat64 = at::kDouble;
+
+/// Rust-style short dtypes.
+constexpr auto kU8 = kUInt8;
+constexpr auto kI8 = kInt8;
+constexpr auto kI16 = kInt16;
+constexpr auto kI32 = kInt32;
+constexpr auto kI64 = kInt64;
+constexpr auto kF32 = kFloat32;
+constexpr auto kF64 = kFloat64;
+
} // namespace torch