【已解决】ValueError: Object arrays cannot be loaded when allow_pickle=False

问题:ValueError: Object arrays cannot be loaded when allow_pickle=False
解决方法:更新代码如下,

import numpy as np
# save np.load
np_load_old = np.load

# modify the default parameters of np.load
np.load = lambda *a,**k: np_load_old(*a, allow_pickle=True, **k)

# call load_data with allow_pickle implicitly set to true
(train_data, train_labels), (test_data, test_labels) = imdb.load_data(num_words=10000)

# restore np.load for future normal usage
np.load = np_load_old

原文链接:https://stackoverflow.com/questions/55890813/how-to-fix-object-arrays-cannot-be-loaded-when-allow-pickle-false-for-imdb-loa

你可能感兴趣的:(tensorflow)