v923z / micropython-ulab

a numpy-like fast vector module for micropython, circuitpython, and their derivatives
https://micropython-ulab.readthedocs.io/en/latest
MIT License
432 stars 117 forks source link

Cannot save and load numpy array on OpenMV4 #526

Closed heleidsn closed 2 years ago

heleidsn commented 2 years ago

Hi, I am doing a small project with OpenMV, thanks for your effort to give us NumPy features for Microcontrollers.

However, I cannot save and load Numpy array with OpenMV which have ulab v4.0.0 with the code below. But I can find docs in the ulab book.

The issues also raised here.

Could you please tell me what's wrong with it? Thanks.

Code

import ulab
from ulab import numpy as np

a = np.array(range(25)).reshape((5, 5))
print(a)
print(ulab.__version__)
np.save('a.npy', a)

Error

AttributeError: 'module' object has no attribute 'save'

v923z commented 2 years ago

The version number only tells you, which methods might be available, but everything might still be switched off. and openmv might have just done that, for reasons of flash space. You could find out, what you have following the description here: finding-out-what-your-firmware-supports

v923z commented 2 years ago

I have just figured out, load and save was introduced in 4.3: https://github.com/v923z/micropython-ulab/blob/master/docs/ulab-change-log.md You have to pick the right version of the documentation.

heleidsn commented 2 years ago

Hi @v923z, thanks for pointing out this, I will build the openmv firmware with the latest ulab.

Many thanks and the issue will be closed.