-
Notifications
You must be signed in to change notification settings - Fork 19
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
Overload elementary operations #139
Conversation
This seems sensible, and impressive 😄 |
Thanks! If you overload the assignment operator then |
As discussed in today's meeting, we should check what happens if an operator that hasn't been implemented is used. I switched from
|
src/ftorch.fypp
Outdated
interface operator (*) | ||
module procedure torch_tensor_multiply | ||
#:for PREC in PRECISIONS | ||
module procedure torch_tensor_premultiply_${PREC}$ | ||
module procedure torch_tensor_postmultiply_${PREC}$ | ||
#:endfor | ||
end interface | ||
|
||
interface operator (/) | ||
module procedure torch_tensor_divide | ||
end interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well pre/post-divide by scalar, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post-divide implemented in b804d54. Left pre-division (i.e., scalar divided by tensor) for now as I don't think it's something people use often and I need to check what that actually does on the Torch side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In f0ed978 I reworked the autograd test so that it tests multiply and divide without changing expected values.
Previously I hard-coded the path to libtorch. This commit replaces the hard-code path using `pip show` to get the updated location.
Merged in the Windows fix from #207. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thnaks @jwallwork23 , this looks great. Just a single comment really and I think it should possibly be a separate issue anyway. lmk what you think. I am happy to merge as is.
(edit: obvs once you address the merge conflict)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jwallwork23
This is a huge step, and really great work.
I have left a couple of queries/suggestions, but the code itself looks good.
I will approve, so feel free to look at my comments as you please and merge.
Co-authored-by: Jack Atkinson <109271713+jatkinson1000@users.noreply.github.com>
Closes #138.
Note that about 1,000 lines of changes are automatically generated from the
ftorch.fypp
changes. So this PR isn't as enormous as it looks.