Usage: Finch backend returns Julia-native dtypes like 'Julia: Float64.' Is this intentional?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 668
- Forks
- 141
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 4
Description
Please provide a description of what you'd like to do.
Hello,
I’ve run into an issue when using the Finch backend via pydata/sparse, specifically with libraries that expect NumPy-compatible dtypes (e.g. when calling np.dtype(...) on sparse arrays).
When I set os.environ["SPARSE_BACKEND"] = "Finch"
and create a COO array from a NumPy array:
import numpy as np
os.environ["SPARSE_BACKEND"] = "Finch"
import sparse
sa = sparse.COO.from_numpy(np.eye(4))
print(sa.dtype) # returns <class 'finch.tensor.Tensor'>
This causes downstream failures in libraries that assume they can call np.dtype(sa.dtype) with the following error TypeError: Cannot interpret 'Julia: Float64' as a data type.
So I have the following questions:
- Is returning 'Julia: Float64' as a dtype string intentional behavior?
- Are there plans to return NumPy-compatible dtype objects instead?
- Are there known workarounds for this kind of downstream compatibility issue?
I wasn’t able to find a discussion of this in the issue tracker, apologies if I missed it.
Thanks so much!
/cc @ilan-gold
Example Code
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported path by setting SPARSE_BACKEND=Finch and calling sparse.COO.from_numpy(np.eye(4)), then inspect the resulting dtype and its behavior with np.dtype. Trace the backend dtype handling and determine whether the compatibility behavior is intentional; done means the expected dtype behavior or workaround is established and covered by an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100