torch.cross' dim default changed to c10::optional instead of int=-1 (#17582)
authorIgor Fedan <ifedan@fb.com>
Tue, 2 Apr 2019 20:18:20 +0000 (13:18 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 2 Apr 2019 20:27:00 +0000 (13:27 -0700)
commit2e97c82470966df6942f364102690460ea58403e
tree417e4fd9d7f5b6d430ddcc762ebae037015439d6
parent3027e783b1cba83546dab50610a9d244bc2632b2
torch.cross' dim default changed to c10::optional instead of int=-1 (#17582)

Summary:
Argument dim=-1 doesn't work for torch.cross. The signature of the torch.cross has been changed to c10::optional<int64_t> dim instead of int64_t. So based on document "If dim is not given, it defaults to the first dimension found with the size 3." and if dim is specified (even negative) it will use the correspondent dim.

Fixes #17229
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17582

Differential Revision: D14483063

Pulled By: ifedan

fbshipit-source-id: f9699093ec401cb185fd33ca4563c8a46cdcd746
16 files changed:
aten/src/ATen/Declarations.cwrap
aten/src/ATen/core/Tensor.h
aten/src/ATen/core/TensorMethods.h
aten/src/ATen/core/Type.h
aten/src/ATen/native/Cross.cpp [new file with mode: 0644]
aten/src/ATen/native/Cross.h [new file with mode: 0644]
aten/src/ATen/native/LegacyDefinitions.cpp
aten/src/ATen/native/cpu/CrossKernel.cpp [new file with mode: 0644]
aten/src/ATen/native/cuda/CrossKernel.cu [new file with mode: 0644]
aten/src/ATen/native/native_functions.yaml
aten/src/TH/generic/THTensorMath.h
aten/src/TH/generic/THTensorMoreMath.cpp
aten/src/THC/generic/THCTensorMathPointwise.cu
aten/src/THC/generic/THCTensorMathPointwise.h
test/test_torch.py
tools/autograd/derivatives.yaml