为了确保矩阵结构是自己想要的,可以多用
- matrix.reshape(rows,columns)
- assert(matrix.shape == (rows,columns))
数据预处理常见步骤:
- Figure out the dimensions and shapes of the problem (m_train, m_test, num_px, …)
- Reshape the datasets such that each example is now a vector of size (num_px num_px 3, 1)
- “Standardize” the data
许多深度学习bug来源于 having matrix/vector dimensions that don’t fit. 如果你能保证matrix/vector dimensions 正确 就可以很方便的避免bug