-
Notifications
You must be signed in to change notification settings - Fork 29
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
[Bug] Failing to slice the CatLinearOperator when indexes are negative or when using boolean array #79
Comments
New findings: I also get a similar error when slicing using boolean array and without using the CatLinearOperator, such as: from linear_operator.operators import IdentityLinearOperator as Ops
N = 4
cond = [True,False,False,True]
ops = Ops(N)
print(ops.shape)
ops[:,cond] Which gives:
|
Looks like there may be a number of places where negative indexing isn't properly supported. I'll put up a fix for the I also don't think we've given much though to supporting boolean indexing with |
Addresses cornellius-gp#79 Looks like there may be a number of places where negative indexing isn't properly supported. This should probably be audited more comprehensively.
Boolean indexing sounds tricky with linear operators. @MoiseRousseau do you have a good use case? |
Addresses #79 Looks like there may be a number of places where negative indexing isn't properly supported. This should probably be audited more comprehensively.
I found a workaround doing |
🐛 Bug
When slicing the CatLinearOperator using a negative index, the final shape of the slice does not match the expected shape and an error is returned. This fails at least for
ToeplitzLinearOperator
, theDiagLinearOperator
and theIdentityLinearOperator
.To reproduce
** Code snippet to reproduce **
** Stack trace/error message **
Expected Behavior
The slice behave as it is working when using positive indexes.
System information
LinearOperator Version 0.5.2
PyTorch Version 2.0.1
Ubuntu 22.04
The text was updated successfully, but these errors were encountered: