I have a 3D matrix like this:
array([[[ 0, 1],
[ 2, 3]],
[[ 4, 5],
[ 6, 7]],
[[ 8, 9],
[10, 11]],
[[12, 13],
[14, 15]]])
and would like to stack them in a grid format, ending up with:
array([[ 0, 1],
[ 2, 3],
[ 4, 5],
[ 6, 7],
[ 8, 9],
[10, 11],
[12, 13],
[14, 15]])
Currently, I'm using numpy as a library.
arr.reshape((-1, 2)), and the link seems to be wrong, reshape is https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.reshape.html. @GrozaiL, but this (-1, 2) feels like magic for me, could you explain how it works? Thanks! – Indominus Jan 14 '19 at 03:56