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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inplace kwarg to torch.nn.functional.silu #570

Merged
merged 5 commits into from
Jun 11, 2024
Merged

Add inplace kwarg to torch.nn.functional.silu #570

merged 5 commits into from
Jun 11, 2024

Conversation

riccardofelluga
Copy link
Collaborator

Before submitting
  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

Temporarily fixes #455 till we implement inplace operators by adding the keyword arg to the operator implementation.
I changed from testing the clang to testing the ltorch symbol as it is a superset of clang in this case so we test both.

@@ -1486,7 +1486,8 @@ def selu(a: TensorProxy, /, inplace: bool = False) -> TensorLike:


@torchsymbol(torch.nn.functional.silu)
def silu(a, /):
def silu(a: TensorLike, inplace: bool = False):
utils.check(not inplace, lambda: "silu only supports inplace=False", exception_type=NotImplementedError)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be nice to include "Thunder" somewhere in the error message so people know it's us not them...

Copy link
Collaborator

@t-vi t-vi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @riccardofelluga

@t-vi t-vi merged commit 335d84c into main Jun 11, 2024
34 of 36 checks passed
@t-vi t-vi deleted the silu-inplace-flag branch June 11, 2024 09:51
@crcrpar
Copy link
Collaborator

crcrpar commented Jun 18, 2024

why is inplace here kwarg unlike inplace of relu?

ref:

def relu(a: TensorLike, /, inplace: bool = False) -> TensorLike:

@t-vi
Copy link
Collaborator

t-vi commented Jun 18, 2024

Probably because it's terrible to pass this without keyword, but you're right, we should ideally match the PyTorch signature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected keyword arg 'inplace' for torch.nn.SiLU
3 participants