summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Chanan <gchanan@fb.com>2019-04-21 14:11:14 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2019-04-21 14:14:34 -0700
commit67330374165c8647ac134c60ad6755bd4fc4efa4 (patch)
tree73610f7da25558a5e32acf6413ac43860db6c303
parent3944601588bba3bd48a18a25595b5862f8130284 (diff)
downloadpytorch-67330374165c8647ac134c60ad6755bd4fc4efa4.tar.gz
pytorch-67330374165c8647ac134c60ad6755bd4fc4efa4.tar.bz2
pytorch-67330374165c8647ac134c60ad6755bd4fc4efa4.zip
Remove 'BoolTensor', 'IndexTensor' from frontend specifications. (#19523)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/19523 ghimport-source-id: 618a15c2d1d9af9f87b46e32f10ff77111c2e3b7 Differential Revision: D15021420 Pulled By: gchanan fbshipit-source-id: 048af8da3128de10bdee5827b6fbc169c3ad25a8
-rw-r--r--aten/src/ATen/function_wrapper.py2
-rw-r--r--aten/src/ATen/native/README.md6
-rw-r--r--tools/autograd/gen_variable_type.py6
3 files changed, 2 insertions, 12 deletions
diff --git a/aten/src/ATen/function_wrapper.py b/aten/src/ATen/function_wrapper.py
index bb6003a560..21943f0593 100644
--- a/aten/src/ATen/function_wrapper.py
+++ b/aten/src/ATen/function_wrapper.py
@@ -969,8 +969,6 @@ def create_generic(top_env, declarations):
# type: (bool) -> Dict[str, str]
return {
'Tensor': 'const Tensor &' if const else 'Tensor &',
- 'BoolTensor': 'const Tensor &' if const else 'Tensor &',
- 'IndexTensor': 'const Tensor &' if const else 'Tensor &',
'Type': 'const Type &' if const else 'Type &',
'TensorOptions': 'const TensorOptions &' if const else 'TensorOptions &',
'TensorList': 'TensorList',
diff --git a/aten/src/ATen/native/README.md b/aten/src/ATen/native/README.md
index 43e48efd5b..3e5b7369fc 100644
--- a/aten/src/ATen/native/README.md
+++ b/aten/src/ATen/native/README.md
@@ -57,12 +57,6 @@ signature.
`Tensor!` - shorthand for Tensor(fresh\_identifier!)
`Tensor(a! -> a|b)` - Tensor is in set `a`, written to, and after the write is in set `a` AND `b`.
For more details on when and why this needs to happen, please see the section on annotations.
-- Tensors of specific types. At the moment, valid type names are:
- - `IntegerTensor` (a.k.a. `LongTensor`)
- - `BoolTensor` (a.k.a. `ByteTensor`)
- - `IndexTensor` (a.k.a. `IntTensor`)
- These type names were inherited from TH, and may be renamed soon, so
- don't commit them to memory.
- `Tensor[]`. A `Tensor[]` argument translates into a C++ argument of type `ArrayRef<Tensor>`
(a.k.a. `TensorList`)
- `int[]`. `int[]` accepts an optional length specifier, e.g., `int[2]`, which
diff --git a/tools/autograd/gen_variable_type.py b/tools/autograd/gen_variable_type.py
index 45e4ffc6ae..87f1318759 100644
--- a/tools/autograd/gen_variable_type.py
+++ b/tools/autograd/gen_variable_type.py
@@ -478,18 +478,16 @@ def emit_body(declaration):
base_name = name[:-1] if inplace else name[:-4] if is_out_fn else name
view_info = VIEW_FUNCTIONS.get(base_name, None)
- # These exclude things like BoolTensor, int64_t, and Scalar
def is_differentiable(arg):
if 'TensorOptions' in arg['type']:
return False
if 'Tensor' not in arg['type']:
return False
if arg['dynamic_type'] in {'IndexTensor', 'BoolTensor'}:
- # TODO: Enable this after native_functions.yaml schema unification.
# These are necessary for legacy code and should be
# used by legacy code only!
- # assert name.startswith('_th_'), \
- # "IndexTensor and BoolTensor are restricted to legacy _th_ functions only.
+ assert declaration['mode'] == 'TH' or declaration['mode'] == 'NN', \
+ "IndexTensor and BoolTensor are restricted to legacy TH/THNN functions only."
return False
if arg['name'] in declaration.get('non_differentiable_arg_names', []):
return False