_SymbolicException: Inputs to eager execution function cannot be Keras symbolic tensors, but found [

When using deep learning to train RNN neural network, due to the use of drop out, in the neural network Some neurons should be inactivated during network training, and all should be retained during runtime (I think it refers to using the verification set for fitting and generalization), because the neurons in the two stages has different states, so a line of code should be added during runtime, and experimental_run_tf_function = False should be added in the brackets of .compile(), otherwise an error will occur as shown in the title.

The specific errors are as follows:

_SymbolicException: Inputs to eager execution function cannot be Keras symbolic tensors, but found [<tf.Tensor 'my_rnn_3/simple_rnn_cell_3/cond/Identity:0' shape=(None, 100) dtype=float32>]

Note that this sentence cannot be added at a position other than the .compile() function, otherwise, adding it means not adding it. The error cannot be solved, and pay attention to the indentation, which should be aligned with the previous line, anddon’t forget to add the English version of the comma.

At this point, the error report has been solved. If there are students who have not solved the problem, you can send me a private message or leave a comment in the comment area below. If you have solved the problem, please use your little hand to get rich with one click and three links~~

Guess you like

Origin blog.csdn.net/m0_64854963/article/details/134561527