Skip to content

Add documentation and tests for utility functions #265

@Smit-create

Description

@Smit-create

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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions