tensorflow (1)WARNING:tensorflow:AutoGraph could not transform;(2)自定义层 无训练的参数

背景:自定义了一个层,该层中引用了一个函数(该函数中有dense层)。

出现问题:

(1) WARNING:tensorflow:AutoGraph could not transform > and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: unexpected indent (, line 10)

WARNING:tensorflow:AutoGraph could not transform > and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: unexpected indent (, line 10)

(2)自定义层中无参数

tensorflow (1)WARNING:tensorflow:AutoGraph could not transform;(2)自定义层 无训练的参数_第1张图片

 

解决方案:

自定义了一个层,该层中引用了一个函数(该函数中有dense层)。   --->  

将函数更改为 class (层)

(1)上述的 WARNING 消失了。

(2)自定义层的参数有了。

tensorflow (1)WARNING:tensorflow:AutoGraph could not transform;(2)自定义层 无训练的参数_第2张图片

你可能感兴趣的:(深度学习)