finch-tensor / finch-tensor-python

Sparse and Structured Tensor Programming in Python
MIT License
8 stars 3 forks source link

Array API support - continuation #48

Closed mtsokol closed 5 months ago

mtsokol commented 5 months ago

Hi @hameerabbasi,

This PR add a couple of simple Array API functions:

    "finfo",  # ported from numpy
    "iinfo",  # ported from numpy
    "isnan",  # the rest is just element-wise functions
    "isinf",
    "isfinite",
    "equal",
    "not_equal",
    "less",
    "less_equal",
    "greater",
    "greater_equal",
    "square",
    "logaddexp",
    "logical_and",
    "logical_or",
    "logical_xor",
    "trunc",

Adds __bool__, etc. to Tensor class.

It also introduces a few modifications to correctly run array-api-test suite.


The tricky part is reshape which we don't have right now but it's required by most of array-api-tests suites to even run them. Maybe one option could be another env var TEST_MODE that when set enables temporary implementation (that moves to numpy, reshapes, and moves back to Tensor). Otherwise NotImplementedError is raised. WDYT?

mtsokol commented 5 months ago

The PR is ready from my side - I added tests and addressed all comments.

codecov-commenter commented 5 months ago

Codecov Report

Attention: Patch coverage is 87.30159% with 8 lines in your changes are missing coverage. Please review.

:exclamation: No coverage uploaded for pull request base (main@8342c52). Click here to learn what that means.

Files Patch % Lines
src/finch/tensor.py 89.47% 6 Missing :warning:
src/finch/dtypes.py 60.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #48 +/- ## ======================================= Coverage ? 91.25% ======================================= Files ? 7 Lines ? 709 Branches ? 0 ======================================= Hits ? 647 Misses ? 62 Partials ? 0 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mtsokol commented 5 months ago

Hi @willow-ahrens @hameerabbasi Can we merge this PR? Do you have any other comments?