Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrimTorch refs do not match argument naming with their PyTorch counterparts #77675

Open
ezyang opened this issue May 17, 2022 · 1 comment
Open
Labels
module: primTorch triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@ezyang
Copy link
Contributor

ezyang commented May 17, 2022

馃悰 Describe the bug

>>> import torch
>>> torch.nn.functional.elu(input=torch.randn(2))
tensor([-0.3709,  0.5241])
>>> import torch._refs.nn.functional
>>> torch._refs.nn.functional.elu(input=torch.randn(2))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/raid/ezyang/pytorch-scratch2/torch/_prims/wrappers.py", line 93, in _fn
    bound = sig.bind(*args, **kwargs)
  File "/scratch/ezyang/pytorch-scratch2-env/lib/python3.8/inspect.py", line 3025, in bind
    return self._bind(args, kwargs)
  File "/scratch/ezyang/pytorch-scratch2-env/lib/python3.8/inspect.py", line 2940, in _bind
    raise TypeError(msg) from None
TypeError: missing a required argument: 'a'

Unfortunately because nothing in PyTorch is positional-only, the argument names are public API

Versions

master

cc @ezyang @mruberry @ngimel

@anjali411 anjali411 added triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module module: primTorch labels May 18, 2022
@mruberry
Copy link
Collaborator

Ideally we would make some args positional-only, but yes, in lieu of that we should just make the names consistent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: primTorch triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

3 participants