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

redo simpler abs and sign #4611

Merged
merged 1 commit into from
May 15, 2024
Merged

redo simpler abs and sign #4611

merged 1 commit into from
May 15, 2024

Conversation

chenyuxyz
Copy link
Collaborator

@chenyuxyz chenyuxyz commented May 15, 2024

moved Sign logic to function.py, and backward always returns 0 to match torch. rewrite abs as self * self.sign(), so its backward also matches torch.

moved Sign logic to function.py, and backward always returns 0 to match torch.
rewrite abs as `self * self.sign()`, so it's backward also matches torch.
Copy link
Contributor

Changes

Name                    Lines    Diff    Tokens/Line    Diff
--------------------  -------  ------  -------------  ------
tinygrad/tensor.py        857      +0           21.9    -0.0
tinygrad/function.py      151      +5           16.0    +0.2


total lines changes: +5

@chenyuxyz
Copy link
Collaborator Author

this should also fix #4411

@chenyuxyz chenyuxyz merged commit 2119e04 into tinygrad:master May 15, 2024
16 checks passed
@chenyuxyz chenyuxyz deleted the abs-sign-2 branch May 15, 2024 22:19
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.

1 participant