背景:自定义了一个层,该层中引用了一个函数(该函数中有dense层)。
出现问题:
(1) WARNING:tensorflow:AutoGraph could not transform <bound method DinAttentionLayer.call of <din.DinAttentionLayer object at 0x1487f00ea198>> 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 (<unknown>, line 10)
WARNING:tensorflow:AutoGraph could not transform <bound method DinAttentionLayer.call of <din.DinAttentionLayer object at 0x1487f00ea198>> 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 (<unknown>, line 10)
(2)自定义层中无参数
解决方案:
自定义了一个层,该层中引用了一个函数(该函数中有dense层)。 --->
将函数更改为 class (层)。
(1)上述的 WARNING 消失了。
(2)自定义层的参数有了。