Skip to content
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): checking None membership in __getitem__ #88

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ilan-gold
Copy link

@ilan-gold ilan-gold commented Feb 3, 2025

I ran into this issue when trying to index with a tuple that had a numpy array in it:

import finch
import numpy as np

tensor = finch.Tensor(np.array([[1, 2], [3, 4]]))
tensor[finch.Tensor(np.array([False, True]))]

Previously, None in key would trigger None==k for k in key (see the link in the comment) which is not really compatible with numpy arrays. Maybe key shouldn't be a numpy array though but couldn't tell? Happy to update.

I don't see any indexing tests that have a numpy array in https://github.com/finch-tensor/finch-tensor-python/blob/main/tests/test_indexing.py though...but also array-api compat would say boolean indexes are good https://data-apis.org/array-api/latest/API_specification/indexing.html#boolean-array-indexing

@hameerabbasi
Copy link
Collaborator

A regression test would be appreciated here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants