IndexError: boolean index did not match indexed array along dimension 1; dimension is 32 but corresp

阅读 84

2022-10-27


在cifar10实验中,期望找到指定标记的所有图像,

(x_train, y_train), (x_test, y_test)=datasets.cifar10.load_data()
print((x_train[y_train==5]).shape)

则会爆出如题错误。简言之,维度问题。通过以下更改:

print((x_train[y_train.reshape(-1)==5]).shape)


精彩评论(0)

0 0 举报