Closed Derfies closed 1 year ago
Ah. After a little more perusing I take it that .flatten is the way to go here?
If you want, we could add .reshape(-1)
as an alias for .flatten
. Are they really the same?
I've used numpy a fair bit but I don't consider myself an authority on the matter. Perhaps leave it as is rather than confused the next boffin who knows the nuance between these two methods!
One element in the tuple can actually be -1: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
@Derfies numpy
is not quite pedantic, and while the documentation states that the unknown dimension length should be -1, it is actually not checked. In any case, https://github.com/v923z/micropython-ulab/pull/612 implements this feature.
Thank you!!
Super handy to be able to flatten an array to 1 dimension in vanilla numpy, eg:
whereas this raises
TypeError: shape must be a tuple
in ulab.Using a tuple, ie arr.reshape((-1,)) gives the same issue unfortunately.