从keras示例运行imdb_lstm.py时 (代码可以在这里找到) https://gist.github.com/raghavgurbaxani/20c08c55eca5e97cd5c51389c091fc9f
我收到错误
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[14,25] = 20000 is not in [0, 20000)
[[Node: embedding_1/GatherV2 = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_HALF,
_class=["loc:@training/Adam/gradients/embedding_1/GatherV2_grad/Reshape"],
_device="/job:localhost/replica:0/task:0/device:CPU:0"](embedding_1/embeddings/read, embedding_1/Cast, lstm_1/TensorArrayUnstack/range/start)]]
Caused by op u`embedding_1/GatherV2`, defined at:
tf.gather不支持float 16吗?
(在Titan X上使用tensorflow 1.8.0,keras 2.2.0)
谢谢:)
答案 0 :(得分:0)
该错误表明您正在尝试获取索引20000,但是该索引不存在。您的索引范围是0到19999。