I am wondering if there is a way to flatten a multidimensional array (i.e., of type ndarray) along given axes without making copies in NumPy. For example, I have an array of 2D images and I wish to flatten each to a vector. So, one easy way to do it is numpy.array([im.flatten() for im in images]), but that creates copies of each.
I am wondering if there is a way to flatten a multidimensional array (i.e.,
Share
ravelit:Or
reshapeit:Under most circumstances, these both return a view of the original array, rather than a copy.