1.X_test_flatten = X_test_orig.reshape(X_test_orig.shape[0],-1).T
.shape[0] 返回矩阵行的长度
-1 reshape时 为一列 即reshape成一个行向量
上述代码成为数据扁平化
2.index = 11
plt.imshow(X_train_orig[index])
print("Y = " + str(np.squeeze(Y_train_orig[:,index])))
首先数据集的X每个数据 是一个矩阵,
数据集Y的每个数据是一个列向量,:代表取遍所有列向量,index代表第几个列向量
squeeze 是将所有维度为1的维度去掉