下面的两个命令不应该返回相同的结果吗?但在下面的情况下,我得到了不同的results...what,我错过了吗?
A trick when you want to flatten a matrix X of shape (a,b,c,d) to a matrix X_flatten of shape (b ∗∗ c ∗∗ d, a) is to use:
X_flatten = X.reshape(X.shape[0], -1).T
train_set_x_flatten = train_set_x_orig.reshape(train_set_x_orig.shape[1]*train_set_x_orig.shape[2]*train_set_x_orig.shape[3],train_set_x_orig.shape[0] )发布于 2020-09-28 04:26:00
这只是一个汉化的问题。缺少括号
试试这个:
train_set_x_flatten = train_set_x_orig.reshape((train_set_x_orig.shape[1]*train_set_x_orig.shape[2]
* train_set_x_orig.shape[3], train_set_x_orig.shape[0]))https://stackoverflow.com/questions/46040592
复制相似问题