Repository navigation
Add vmap for SVD and inverse and fix some other ops - #849
Conversation
awni
left a comment
There was a problem hiding this comment.
It looks great! Minor nits inline.
|
@nicolov the tests are failing.. could you take a look? |
angeloskath
left a comment
There was a problem hiding this comment.
This looks great!
I left a comment regarding handling non vectorized axes. The linux test seems to fail on the vmap test and the Mac test seems unrelated and possibly a fluke. I launched both tests again but it is unlikely that the linux one will clear.
|
I'm looking into it. Linux (not Mac) calls |
|
Yeah indeed I also saw that (that's weird and I may look into it later if you haven't fixed it by then). My suggestion has to do with the general correctness for cases where the input is not vmapped. So it wouldn't fix that... |
But in those cases |
| const std::vector<array>& inputs, | ||
| const std::vector<int>& axes) { | ||
| auto [a, b, to_ax] = vmap_binary_op(inputs, axes, stream()); | ||
| return {{equal(a, b, stream())}, axes}; |
| assert( | ||
| "Expected the number of outputs and vmapped axes to match. Please fix " | ||
| "the vmap implementation for this primitive."); |
There was a problem hiding this comment.
I'm not sure what is the purpose of this loc, maybe remove?
There was a problem hiding this comment.
I think this was assert(v_outputs.size() == v_out_axes.size(), "...") but I kind of agree that we should remove it.
angeloskath
left a comment
There was a problem hiding this comment.
Let's merge after removing the assert.
Proposed changes
Add vmap for SVD and inverse, following #836
Also fix a bug in the
vmapimplementation of some binary ops, that was causing an issue on Linux (but not on Mac, probably because of different initial sizing and/or initialization ofstd::vector).Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes