ValueError:无法调整此数组的大小:它不拥有其数据
from keras.datasets import cifar10
import numpy as np
(X_train, y_train), (X_test, y_test) = cifar10.load_data()
X_train1 = X_train.copy().ravel()
y_train1 = y_train.copy().ravel()
X_train2 = X_train1.resize(64*64*500)
y_train2 = y_train1.resize(64*64*500)
X_train = X_train2.resize(64*64*500).reshape(64, 64, 1)
y_train = y_train2.resize(64*64*500).reshape(64, 64, 1)
为什么在显式复制数据后出现此错误?该如何解决?
答案 0 :(得分:1)
在numpy中使用整形,将行更改为
X_train2 = np.resize(X_train1, 64*64*500)
y_train2 = np.resize(y_train1, 64*64*500)