Set and get default dtype (#13748)
authorPeter Goldsborough <psag@fb.com>
Wed, 5 Dec 2018 18:18:20 +0000 (10:18 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 5 Dec 2018 18:28:41 +0000 (10:28 -0800)
commit3ae721d3501c56cdf6819fe40a54dc6b77900fdd
tree70fbc9b9ec169fc6da84a5a7fed5a326057a6687
parent90b1196ac44095fbf5516c5aa5e8795485db704e
Set and get default dtype (#13748)

Summary:
Replaces the `DefaultTensorOptions` with just a global default dtype that you can set and get like in Python.

Also, calls `set_default_dtype` in the implementation of `torch.set_default_dtype`. Right now these two default values are separate but will always be the same. Should we just bind `set_default_dtype`  into Python? I think that might be good to do in a separate PR though.

ezyang gchanan

Also CC colesbury who wanted to do this for ATen for a while? What do you think about it?
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13748

Differential Revision: D13340207

Pulled By: goldsborough

fbshipit-source-id: 2689b09eb137fabb3a92d1ad1635782bee9398e8
aten/src/ATen/core/DefaultDtype.cpp [new file with mode: 0644]
aten/src/ATen/core/DefaultDtype.h [new file with mode: 0644]
aten/src/ATen/core/DefaultTensorOptions.h [deleted file]
aten/src/ATen/core/TensorOptions.h
test/cpp/api/tensor_options.cpp
test/test_cpp_extensions.py
torch/csrc/tensor/python_tensor.cpp