pytorch/torch/csrc/utils
Brennan Vincent 0a3fb45d3d allow passing Python built-in types as dtypes (#21215)
Summary:
Another simple bit of syntax that NumPy supports and we don't.

Support int, float, and bool.

```python
>>> torch.randn((2,3), dtype=float)
tensor([[-0.1752, -0.3240, -0.6148],
        [ 0.1861,  1.6472,  0.1687]], dtype=torch.float64)
```

A bit confusingly, Python's "float" actually means double, but nothing we can do about that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21215

Differential Revision: D15697012

Pulled By: umanwizard

fbshipit-source-id: 9a38d960a610b8e67023486b0c9265edd3c22246
2019-06-06 13:17:23 -07:00
..
auto_gil.h
cuda_enabled.h
cuda_lazy_init.cpp
cuda_lazy_init.h
disallow_copy.h
hash.h
invalid_arguments.cpp
invalid_arguments.h
memory.h
numpy_stub.h
object_ptr.cpp
object_ptr.h Split python_ir.h in a more sensible way (#19081) 2019-04-10 10:26:50 -07:00
pybind.h Convert all tabs to spaces, add CI. (#18959) 2019-04-09 08:12:26 -07:00
python_arg_parser.cpp allow passing Python built-in types as dtypes (#21215) 2019-06-06 13:17:23 -07:00
python_arg_parser.h allow passing Python built-in types as dtypes (#21215) 2019-06-06 13:17:23 -07:00
python_compat.h Fix PySlice_Unpack not available on PyPy 3.6 yet (#17836) 2019-03-09 20:10:16 -08:00
python_numbers.h Cleanup includes in torch/csrc/* (#19924) 2019-05-06 14:03:18 -07:00
python_scalars.h Resolving comments from Bool Tensor for CPU PR (#18165) 2019-03-26 09:59:34 -07:00
python_strings.h Provide a few default args for numpy translation (#20451) 2019-05-15 10:13:17 -07:00
python_stub.h
python_tuples.h
six.h Allow structseq to be input of operators where tuple is expected (#17208) 2019-03-11 11:33:35 -07:00
structseq.cpp Attempt to fix flaky test_structseq_repr (#20931) 2019-05-24 15:55:44 -07:00
structseq.h Customize the printing of namedtuple return (#17136) 2019-02-28 13:07:26 -08:00
tensor_apply.cpp Introduce DeprecatedTypeProperties class (#17991) 2019-04-04 02:24:13 -07:00
tensor_apply.h
tensor_dtypes.cpp Add qint8 type (int8_t) (#19984) 2019-05-17 20:35:05 -07:00
tensor_dtypes.h
tensor_flatten.cpp Generate only one Type class per backend (#19295) 2019-04-21 21:16:14 -07:00
tensor_flatten.h C++ changes toward libtorch and libcaffe2 unification (#19554) 2019-04-26 01:38:10 -07:00
tensor_layouts.cpp Cleanup includes in torch/csrc/* (#19924) 2019-05-06 14:03:18 -07:00
tensor_layouts.h
tensor_list.cpp Remove some simple use cases of Type::ScalarType() 2019-03-08 16:42:05 -08:00
tensor_list.h
tensor_memoryformats.cpp Memory format support for contiguous and is_contiguous (#20455) 2019-05-16 07:18:24 -07:00
tensor_memoryformats.h Memory format support for contiguous and is_contiguous (#20455) 2019-05-16 07:18:24 -07:00
tensor_new.cpp Expunge some more deprecated uses of AT_CHECK. 2019-06-05 10:25:25 -07:00
tensor_new.h Pass ScalarType separately from Type in python constructors 2019-04-04 02:24:20 -07:00
tensor_numpy.cpp Auto-convert GPU arrays that support the __cuda_array_interface__ protocol (#20584) 2019-05-21 14:06:46 -07:00
tensor_numpy.h Auto-convert GPU arrays that support the __cuda_array_interface__ protocol (#20584) 2019-05-21 14:06:46 -07:00
tensor_types.cpp Sparse half embeddings on cuda (#19695) 2019-05-10 08:00:55 -07:00
tensor_types.h Generate only one Type class per backend (#19295) 2019-04-21 21:16:14 -07:00
tuple_parser.cpp
tuple_parser.h
variadic.cpp
variadic.h