Skip to content

sparse doesn't support shape kwarg in full_like #422

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

Closed
max-sixty opened this issue Jan 1, 2021 · 2 comments · Fixed by #423
Closed

sparse doesn't support shape kwarg in full_like #422

max-sixty opened this issue Jan 1, 2021 · 2 comments · Fixed by #423
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@max-sixty
Copy link

Describe the bug
I'm attempting to use NEP18 functionality to include sparse arrays in xarray's unstack refactor: pydata/xarray#4746

I'm not that familiar with the NEP18 interface, but currently I'm getting failures when using np.full_like and including a sparse keyword argument. Even if sparse doesn't require it, could it pass it through to maintain compatibility?

To Reproduce

In [1]: import sparse

In [2]: sparse.ones(5)
Out[2]: <COO: shape=(5,), dtype=float64, nnz=0, fill_value=1.0>

In [3]: x = _

In [4]: import numpy as np

In [12]: np.full_like(x, fill_value=0, shape=(2,2))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-cf45b2f0c703> in <module>
----> 1 np.full_like(x, fill_value=0, shape=(2,2))

<__array_function__ internals> in full_like(*args, **kwargs)

/usr/local/lib/python3.8/site-packages/sparse/_sparse_array.py in __array_function__(self, func, types, args, kwargs)
    244             pass
    245         else:
--> 246             return sparse_func(*args, **kwargs)
    247
    248         try:

Expected behavior
A clear and concise description of what you expected to happen.

System

  • OS and version: MacOS
  • sparse version (sparse.__version__) 0.11.2
  • NumPy version (np.__version__) 1.19.2
  • Numba version (numba.__version__) 0.51.2

Additional context
Add any other context about the problem here.

@max-sixty max-sixty added the bug Indicates an unexpected problem or unintended behavior label Jan 1, 2021
@hameerabbasi
Copy link
Collaborator

This is fixed in the latest master.

@max-sixty
Copy link
Author

Thanks @hameerabbasi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants