TypeError: TF_SessionRun_wrapper: expected all values in input dict to be ndarray.

在用Embedding时出现了这个问题,具体的代码:

model.add(Embedding(input_dim = vocab_size, output_dim = embedding_vector_size, input_length = max_len, weights = [embedding_matrix]))

本来以为是参数类型的问题,但怎么也找不出来,最后看github发现了解决方法:重装numpy(我也不知道为什么—.—)

记住在重装numpy的时候要关掉你的IDE或jupyter notebook,不然会出现类似:

PermissionError: [WinError 5] 拒绝访问。的警告,可能导致删不干净。

然后重装numpy即可

pip uninstall numpy
pip install numpy

 

posted @ 2019-05-11 11:19  boobo  阅读(2460)  评论(0编辑  收藏  举报
^