In this example we will show how to use unknown dimensions when reshaping in Python NumPy.
Source Code
import numpy as np
n = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
reshape_n = n.reshape(2, -1, 3)
print(reshape_n)
Output:
[[[ 1 2 3]
[ 4 5 6]]
[[ 7 8 9]
[10 11 12]]]