The example given below will help you to understand the meaning of NumPy reshape -1. If you want to learn Python, I highly recommend reading This Book.
import numpy as np a = np.array([[1,2,3], [4,5,6]]) print(a) print(a.reshape(-1)) print(a.reshape(6,-1)) print(a.reshape(3,-1))
Output:
[[1 2 3] [4 5 6]] [1 2 3 4 5 6] [[1] [2] [3] [4] [5] [6]] [[1 2] [3 4] [5 6]]
People are also reading:
What is Computer Vision? Examples, Applications, Techniques
Books for Machine Learning (ML)