1. 程式人生 > 其它 >_SymbolicException: Inputs to eager execution function cannot be Keras symbolic tensors, but found [

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

技術標籤:推薦系統tensorflowpython人工智慧深度學習機器學習

一、問題

tensorflow 2.2.0版本,用tf.keras訓練YoutubeDNN模型,遇到了這個錯誤:

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

二、解決方式

增加下述程式碼:

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()