-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Make Sparse
tensor Type
s extend TensorType
#766
Make Sparse
tensor Type
s extend TensorType
#766
Conversation
I did a rebase of the branch to the master, which resulted in some of the tests being broken. Now I'm fixing the bugs that occurred, but I decided to open this PR to be able to track progress and discuss changes. |
Sparse
tensor Type
s extend TensorType
d482291
to
2c405c5
Compare
Codecov Report
@@ Coverage Diff @@
## main #766 +/- ##
==========================================
+ Coverage 78.48% 78.50% +0.02%
==========================================
Files 154 154
Lines 47773 47857 +84
Branches 10853 10879 +26
==========================================
+ Hits 37494 37572 +78
Misses 7743 7743
- Partials 2536 2542 +6
|
@brandonwillard , Looks like I fixed tests that were broken after rebase. In your initial PR #303 you noticed that we should "Convert sparse to dense when used with some |
In order to make the old We can get around this by dispatching to the appropriate sparse Really, that's all we need to do in order to merge this: i.e. make sure the new interface doesn't generate graphs that necessarily produces errors, and converting to a dense matrix is a quick and dirty work-around in most cases. |
5759d72
to
71bc74c
Compare
@brandonwillard , I added tests to check that no errors occurred when using |
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.
It looks like you have all the necessary logic in there. I left a few comments about where certain steps take place (e.g. in the sparse module vs. others). The basic idea is that we want to keep all sparse object related handling within the sparse module. In other words, we don't want the concerns of sparse types to leak into code that doesn't explicitly need to concern itself with sparse types.
My guess is that those lines of code can be moved into the sparse Variable
interface before the external code is called.
Aside from that, we'll need to rebase some of those commits (e.g. combine test-adding commits with their respective code changes, merge/remove commits that undo things performed by earlier commits in this branch, etc.) and update their formatting to match these guidelines (just the summary lines for now). Since this is such a large set of changes, these kinds of things are even more important—both for the reviewing overhead and basic organizational reasons.
737e1fe
to
29fe431
Compare
Hi @brandonwillard ! I made the changes according to your comments. Now I override in |
Great, thanks! I'm still a bit backlogged, but I'll review soon. |
Hi @brandonwillard! I just wanted to remind you of this PR just in case. Of course, if you have time for that. |
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.
It looks like there were some problems rebasing, because there are a few reversions of upstream changes and unmanaged conflict diffs.
aesara/graph/features.py
Outdated
@@ -559,7 +559,7 @@ def replace_all_validate( | |||
|
|||
for r, new_r in replacements: | |||
try: | |||
fgraph.replace(r, new_r, reason=reason, verbose=False, **kwargs) | |||
fgraph.replace(r, new_r, reason=reason, verbose=verbose, **kwargs) |
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.
fgraph.replace(r, new_r, reason=reason, verbose=verbose, **kwargs) | |
fgraph.replace(r, new_r, reason=reason, verbose=False, **kwargs) |
verbose
is set to False
here because this method handles that functionality itself.
I'll fix the rebase issues and push in a minute. |
85a9ad1
to
d90e52d
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.
There's still more to be done to get the sparse interface into shape, but these changes look like a good step toward that, if only because they explicitly state that we want a more correct type representation.
The biggest issue right now is that TensorType
s aren't an abstract class, and direct instances of TensorType
s represent dense tensors, alongside instances of the new DenseTensor
type. It might not take much to make such a change and remove all the meta classes, though.
Anyway, I'm fine moving forward with these changes and opening another set of issues to follow up, but let's get a few more eyes on this first.
LGTM.
We should make an issue page for this. Since, this can be tackled separately from the additional logic that we add towards supporting |
b3f64a8
to
cc36b11
Compare
Hi @brandonwillard! I rebased on top of the master and resolved the conflicts. |
cc36b11
to
660fb4c
Compare
The location and name of the new |
660fb4c
to
e824666
Compare
I've updated the new tests and added a commit that renames |
9843e8d
to
d7179fc
Compare
@brandonwillard, Thanks for the review and the corrections! |
@aerubanov, thanks for the PR! This was an important one that required a lot of persistence. It's this kind of help that really moves things forward, and we truly appreciate it. |
This pull request is a continuation of the work in PR #303 on refactors the sparse tensor type structure so that sparse types extend the existing tensor types.
Closes #142.