Skip to content

Usage: Finch backend returns Julia-native dtypes like 'Julia: Float64.' Is this intentional? #915

@amalia-k510

Description

@amalia-k510

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    usageUsage question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions