tf2.0在模型的call()中调用tf.keras.layers.embedding,出错 tf.function-decorated function tried to create variables on non-first call
解决方法:
不要再call中调用tf.keras的接口,使其在模型定义的init()方法中定义。
如
`def __init__():
self.embed_seq = tf.keras.layers.Embedding(8874, input_length=self.playlength, output_dim=32)
def call():
y = embed_seq(x)
`