-
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
Unit tests for operator overloading; fix scalar bug #225
Conversation
Following our discussion in the meeting, I've now extended the power functionality to account for both integers and floats, replacing |
b6cd616
to
e03f75c
Compare
[Rebased on top of |
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.
Hi @jwallwork23 This looks great.
Am I correct that you've restructured the C++ to match the re-organising you did in the Fortran?
One observation (that is not to be resolved here) is that our online API docs are no longer very useful for basic users and are instead geared at developers.
In reality, all basic users want is the Interface
docs, and the list they get above is somewhat daunting. There is an option to lost interfaces here but I don't feel it helps. I'm not sure if there is an easy solution to this and should perhaps create a new issue.
Oh, I didn't do that actually. Can do in a follow-up PR, though. |
That's a good point. I guess this is a downside of the fypp approach? |
Opened #232. |
Closes #221.
Closes #224.
This PR implements unit tests for the overloaded operators acting on tensors using funit.
While implementing these tests, I discovered that pre/post multiplication by scalar, post-division by scalar, and scalar exponent don't work if the scalar is non-integer. This was an oversight by me, which is fixed in this PR. It turns out you can multiply/divide any tensor by a [1] tensor and torch treats it as a scalar, so that's what I do here.
In the case of exponentiation, it doesn't seem to be valid to have a tensor exponent. I revised the implementation to use a
torch_scalar_t
type and restricted attention to the integer case for now.