Tensorflow常见的问题:
- Cannot interpret feed_dict key as Tensor:
是因为feed_dict中的key在计算图中找不到。
sess.run(loss, feed_dict={"input_ids":inputs, "labels":labels})
上面代码的错误在于将key"input_ids"写成了字符串,正确如下:
sess.run(loss, feed_dict={input_ids:inputs, labels:labels}
-
Tensor Tensor(“Placeholder:0”, shape=(?, 250), dtype=int32) is not an element of this graph.
这个是因为***把计算图写tf.Graph外面了,无语。 -
Tensor objects are only iterable when eager execution is enabled. To iterate over this tensor use tf.map_fn.
原因是tensor placeholder对象不可能迭代遍历.
for single in input_ids:
print("aaa\n")
- InternalError: Dst tensor is not initialized
OOM的问题, 重启pycharm不好使, 直接重启电脑。