Bool Tensor for CUDA (#18166)
authorIurii Zdebskyi <iuriiz@fb.com>
Tue, 2 Apr 2019 23:10:43 +0000 (16:10 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 2 Apr 2019 23:17:05 +0000 (16:17 -0700)
commitb832b99afb241a8b6ea9fc34698d1f3bfd451f00
tree0717b959c1718010605006193fb070557df6e1be
parentb77e3c2ca1790cfd4414d15f0a0952a630dc22c9
Bool Tensor for CUDA (#18166)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18166
ghimport-source-id: a8e2ba2d966e49747a55701c4f6863c5e24d6f14

Stack from [ghstack](https://github.com/ezyang/ghstack):
* **#18166 Bool Tensor for CUDA**
* #18165 Resolved comments from Bool Tensor for CPU PR
------

This PR enables bool tensor creation and some basic operations for the CPU backend. This is a part of Bool Tensor feature implementation work. The whole plan looks like this:
1. Storage Implementation [Done]
2. Tensor Creation.
a) CPU [Done]
b) CUDA [This PR]
3. Tensor Conversions.
4. Tensor Indexing.
5. Tensor Operations.
6. Back compatibility related changes.

Change:
Enable bool tensor in CUDA with the following operations:

    torch.zeros
    torch.tensor
    torch.ones
    torch.rand/rand_like/randint/randint_like
    torch.full
    torch.full_like
    torch.empty
    torch.empty_like

Tested via unit tests and local scripts.

Differential Revision: D14605104

fbshipit-source-id: b7d7340a7d70edd03a109222d271e68becba762c
20 files changed:
aten/src/ATen/Declarations.cwrap
aten/src/ATen/function_wrapper.py
aten/src/ATen/gen.py
aten/src/ATen/native/TensorCompare.cpp
aten/src/ATen/native/cpu/CopyKernel.cpp
aten/src/ATen/native/cuda/CUDAScalar.cu
aten/src/ATen/native/cuda/Copy.cu
aten/src/ATen/native/cuda/TensorCompare.cu
aten/src/ATen/native/native_functions.yaml
aten/src/ATen/native_parse.py
aten/src/ATen/preprocess_declarations.py
aten/src/THC/THCTensorMath.cu
aten/src/THC/THCTensorMath.h
aten/src/THC/THCTensorRandom.cu
aten/src/THC/THCTensorRandom.h
aten/src/THC/generic/THCTensorMath.cu
aten/src/THC/generic/THCTensorMath.h
c10/util/Half.h
test/test_torch.py
torch/testing/__init__.py