Cleanup arg{min, max} (#17103)

Summary:
Why do we need this workaround? `PythonArgParser` handles these two cases well.

The discussion started at https://github.com/pytorch/pytorch/pull/6201#issuecomment-378724406. The conclusion at that time by goldsborough was:

> Because we wanted to allow `dim=None` in Python and route to a different function. Essentially the problem was wanting to wrap the C++ function in Python. AFAIK there is no way of translating `dim=None` behavior into C++? So Richard and I came up with this strategy

Maybe at that time `PythonArgParser` was not powerful enough to handle the routing of two function with same name but different C++ signature.

Will keep an eye on the CI.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17103

Differential Revision: D14523503

Pulled By: VitalyFedyunin

fbshipit-source-id: cae3e2678062da2eccd93b51d4050578c7a9ab80
This commit is contained in:
Gao, Xiang
2019-03-20 16:18:49 -07:00
committed by Facebook Github Bot
parent ebc9f75895
commit 7e6220393f
13 changed files with 156 additions and 140 deletions

View File

@ -1487,6 +1487,13 @@ max(dim=None, keepdim=False) -> Tensor or (Tensor, Tensor)
See :func:`torch.max`
""")
add_docstr_all('argmax',
r"""
argmax(dim=None, keepdim=False) -> LongTensor
See :func:`torch.argmax`
""")
add_docstr_all('mean',
r"""
mean(dim=None, keepdim=False) -> Tensor or (Tensor, Tensor)
@ -1508,6 +1515,13 @@ min(dim=None, keepdim=False) -> Tensor or (Tensor, Tensor)
See :func:`torch.min`
""")
add_docstr_all('argmin',
r"""
argmin(dim=None, keepdim=False) -> LongTensor
See :func:`torch.argmin`
""")
add_docstr_all('mm',
r"""
mm(mat2) -> Tensor