micropython-ulab icon indicating copy to clipboard operation
micropython-ulab copied to clipboard

Constructed array using ulab.numpy.ndarray()

Open water5 opened this issue 4 years ago • 3 comments

https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html

Refer numpy.ndarray(shape), its parameter is shape, although arrays should be constructed using array(), arange(), zeros() ... and ulab.numpy support 2D array currently, but I think compatible numpy.ndarray() will be a good idea.

Currently: ulab.numpy.ndarray((2, 2)) -> array([2.0, 2.0], dtype=float32)

water5 avatar Feb 01 '21 16:02 water5

This is correct, but I don't see at the moment, where the problem is. I am afraid, it might have to do with how micropython is implemented. I will look into this, though.

v923z avatar Feb 01 '21 18:02 v923z

Ah, looks like I didn't read the spec properly for #280 :sweat_smile: I'll try to get a fix out by tomorrow.

CallumJHays avatar Feb 01 '21 22:02 CallumJHays

@CallumJHays OK, thanks! I think you are right, one can catch this in the constructor function, or in ndarray_make_new.

v923z avatar Feb 02 '21 05:02 v923z