【已解决】Try using tf.compat.v1.experimental.output_all_intermediates(True).

报错信息

InvalidArgumentError: Node 'training/AdamEMA/gradients/Transformer-11-FeedForward-Dropout/cond_grad/StatelessIf': Connecting to invalid output 1 of source node Transformer-11-FeedForward-Dropout/cond which has 1 outputs. Try using tf.compat.v1.experimental.output_all_intermediates(True).

报错原因

由于使用的tensorflow版本是2.x,而代码本身基于tensorflow1.x

解决办法

文件的最前面添加如下信息:
import tensorflow as tf
tf.compat.v1.experimental.output_all_intermediates(True)

要注意:

不能定义到报错的位置,要在main函数所在的代码文件最前面添加上面那句话。

你可能感兴趣的:(bug,tensorflow,bug)