-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add ops.getslice for complex indexing by int,slice,None,Ellipsis #555
Conversation
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.
Code looks good, but can you add a couple of tests for Lambda
with multiple-value indices to exercise eager_getslice_lambda
?
funsor/terms.py
Outdated
if head != slice(None): | ||
expr = expr(**{x.var.name: head}) | ||
if x.var.name not in expr.inputs: | ||
return expr |
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.
What if tail
is not empty here?
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.
thanks, fixed
ok, I've added some simple tests for multiple value indices |
Addresses #556
Blocking #553
This adds
ops.getslice
to perform fancy slice operations likex[..., 0, ::2, None, :]
, in particular supporting nontrivial slicing, and supporting unsqueezing via None. These fancier slicing ops will be needed for symbolic Gaussians #556. Note this now distinguishes betweenops.getitem
which supports "advanced indexing" where funsors can appear in the index, fromops.getslice
which supports only indexing of ground values. Numpy distinguishes semantics of these two types of indexing, and it is much easier to fully implement ground indexing (which I believe this PR does forops.getitem
).Tested