|
在cifar10实验中,期望找到指定标记的所有图像,
(x_train, y_train), (x_test, y_test)=datasets.cifar10.load_data()
print((x_train[y_train==5]).shape)
1
2
则会爆出如题错误。
IndexError: boolean index did not match indexed array along dimension 1; dimension is 32 but corresp
简言之,维度问题。通过以下更改:
print((x_train[y_train.reshape(-1)==5]).shape)
|
|