查看: 3522|回复: 0

IndexError: boolean index did not match indexed array

[复制链接]

38

主题

84

帖子

243

积分

中级会员

Rank: 3Rank: 3

积分
243
发表于 2019-2-11 20:29:26 | 显示全部楼层 |阅读模式
在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)


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表