-
Notifications
You must be signed in to change notification settings - Fork 102
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
Fix tensordot implementation #607
Conversation
1e2e7ae
to
15bc7ce
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #607 +/- ##
==========================================
- Coverage 80.87% 80.86% -0.01%
==========================================
Files 162 162
Lines 46680 46743 +63
Branches 11408 11419 +11
==========================================
+ Hits 37751 37800 +49
- Misses 6699 6705 +6
- Partials 2230 2238 +8
|
437be34
to
5f1fc1d
Compare
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.
Btw this looks much better than the previous implementation!
We should open an issue to deprecate the old tensordot as dot utility
1f7321f
to
1fe21db
Compare
I'll open an issue for it |
Some small docstring tweak and a possible nitpick in the test (feel free to ignore) and this is good from my side |
Thanks @lucianopaz ! |
Description
This PR discards the past implementation of
tensordot
and uses the one fromnumpy
. The past implementation had many problems:axes
as a sequence of sequences, it tried to do transpose the dimensions and then calltensordot
again usingaxes
as an integer. This made things harder to maintain.tensordot
is broken #606.Taking the implementation from
numpy
works well. It handles all the cases ofaxes
, it has a single execution branch, and preserves the static shape information. The only downside is that it does not have the logic to implementbatched_tensordot
. From my point of view, this is a good thing.batched_dot
andbatched_tensordot
were poor-men implementations of what we can now do usingBlockwise
and better vectorization. I think that those two could be deprecated altogether and eventually removed.I still haven't added tests for this PR because I want to see the current test suite coverage report.The coverage report showed that there was a test that needed to be adapted, but most oftensordot
was already covered by the existing test suite. I added special tests for #606, static shape and runtime shape validation.Related Issue
tensordot
is broken #606Checklist
Type of change