Object arrays cannot be loaded when allow_pickle=False 报错 (解决方法)(来自《Python 深度学习》P190页代码)

1. 报错问题:(来自《Python 深度学习》P190页代码)

在Vscode运行下述代码的时候,报错:Object arrays cannot be loaded when allow_pickle=False

from keras.datasets import imdb
from keras.preprocessing import sequence

max_features = 10000  
# Number of words to consider as features(作为特征的单词个数)
max_len = 500  
# cut texts after this number of words (among top max_features most common words)
# 在这么多单词之后截断文本(这些单词都属于前 max_features 个最常见的单词)
print('Loading data...')
(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=max_features)
print(len(x_train), 'train sequences')
print(len(x_test), 'test sequences')

print('Pad sequences (samples x time)')
x_train = sequence.pad_sequences(x_train, maxlen=max_len)
x_test = sequence.pad_sequences(x_test, maxlen=max_len)
print('x_train sh
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值