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

Add documentation and tests for utility functions #265

Open
Smit-create opened this issue Dec 29, 2021 · 1 comment
Open

Add documentation and tests for utility functions #265

Smit-create opened this issue Dec 29, 2021 · 1 comment
Assignees

Comments

@Smit-create
Copy link

Smit-create commented Dec 29, 2021

Here is the code that shows that all_of_type changes the dimension of sos_f32 below:

>>> from scipy._lib.uarray import all_of_type
>>> import numpy as np
>>> @all_of_type(np.ndarray)
... def f(p):
...     return p
... 
>>> sos_f32  = np.array([[4., 5., 6., 1., 2., 3.]], dtype=np.float32)
>>> sos_f32
array([[4., 5., 6., 1., 2., 3.]], dtype=float32)
>>> sos_f32.shape
(1, 6)
>>> f(sos_f32)
(<Dispatchable: type=<class 'numpy.ndarray'>, value=array([4., 5., 6., 1., 2., 3.], dtype=float32)>,)
>>> f(sos_f32)[0].value.shape
(6,)

I was expecting sos_f32 and f(sos_f32)[0].value to have same dimensions. Is this a bug?

Original comment: rgommers/scipy#101 (comment)

@hameerabbasi
Copy link
Collaborator

Seems like Ralf already answered the original question in the thread, but I'll add an assert and some tests as he suggests.

@hameerabbasi hameerabbasi self-assigned this Jan 5, 2022
@hameerabbasi hameerabbasi changed the title BUG: all_of_type changes dimension of 2D array all_of_type changes dimension of 2D array Jan 5, 2022
@hameerabbasi hameerabbasi changed the title all_of_type changes dimension of 2D array Add documentation and tests for utility functions Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants