In [1]:
import numpy as np
In [2]:
a = np.arange(12).reshape(3, 4)
print(a)
In [3]:
%%timeit
a.ravel()
In [4]:
%%timeit
a.flatten()
In [5]:
%%timeit
a.reshape(-1)
In [6]:
a_large = np.arange(1000000).reshape(100, 100, 100)
In [7]:
%%timeit
a_large.ravel()
In [8]:
%%timeit
a_large.flatten()
In [9]:
%%timeit
a_large.reshape(-1)