你好，我的代码报错了，麻烦您帮我看一下。
代码如下：import keras
from keras.models import Model
from keras.layers import Dense, Input, Lambda
import tensorflow as tf
import numpy as np
# 模型的输入是 cx,cp,cs,t 模型的输出是 y= [k1 ,k2 ,k3].
# 实际的输出是 z = odeint(mechanistic_model, [cx,cp,cs],2,args = (y,))

def mechanistic_model_for_p(y, t, para):
    alpha, beta, gamma,dcxdt,cx = para
    cp= y
    dcpdt = alpha * dcxdt + beta * cx + gamma * cp
    return [dcpdt]


def func(x, k):
    # 你的实际函数，现在同时接受 x 和 k 作为输入
    t,cx_t,cs_t,cp_t = x
    t, cx_t, cs_t, cp_t = tf.unstack(t,cx_t,cs_t,cp_t, axis=1)
    alpha, beta, gamma, = k
    cx_tp1 = xgboost_model.predict([t,cx_t,cs_t,cp_t], verbose=0)
    dcxdt = (cx_tp1 - cx_t)/1
    cp_tp1 = mechanistic_model_for_p([cp_t],t,[alpha, beta, gamma,dcxdt,cx_t])[0]
    return cp_tp1


def func_layer(tensors):
    # 使用 Tensorflow 在 Lambda 层中实现 func 函数，现在接受 x 和 k 作为输入
    x, k = tensors
    
    return func(x, k)

# 创建从 x 到 k 的模型
input_x = Input(shape=(4,))
hidden = Dense(units=4, activation="sigmoid")(input_x)
output_y = Dense(units=3, activation="linear")(hidden)
x_to_k_model = Model(inputs=input_x, outputs=output_y)

# 创建 func 函数的模型，现在接受 x 和 y 作为输入
input_x_for_func = Input(shape=(4,))
input_k_for_func = Input(shape=(3,))
output_z = Lambda(func_layer)([input_x_for_func, input_k_for_func])
func_model = Model(inputs=[input_x_for_func, input_k_for_func], outputs=output_z)

# 将 x 到 k 的模型与 func 模型连接
output_z_from_x_and_y = func_model([input_x, x_to_k_model.output])
x_to_z_model = Model(inputs=input_x, outputs=output_z_from_x_and_y)

# 用已知的 x 和 z 数据训练完整的模型
X_For_ANN_Cp = pd.DataFrame({
    'Time':xgboost_df['Time'],
    'Biomass_t':xgboost_df['Biomass_t'],
    'Substrate_t':xgboost_df['Substrate_t'],
    'Product_t':xgboost_df['Product_t'],
}
)
Z_For_ANN_Cp = pd.DataFrame({
    'Cp_t+1':xgboost_df['Product_t+1'],
}
)

x_train, x_test, z_train, z_test = train_test_split(X_For_ANN_Cp, Z_For_ANN_Cp, test_size=0.2, random_state=4)
x_to_z_model.compile(optimizer="adam", loss="mse")
x_to_z_model.fit(x_train, z_train)

报错信息如下：
---------------------------------------------------------------------------
OperatorNotAllowedInGraphError            Traceback (most recent call last)
Cell In[105], line 42
     40 input_x_for_func = Input(shape=(4,))
     41 input_k_for_func = Input(shape=(3,))
---> 42 output_z = Lambda(func_layer)([input_x_for_func, input_k_for_func])
     43 func_model = Model(inputs=[input_x_for_func, input_k_for_func], outputs=output_z)
     45 # 将 x 到 k 的模型与 func 模型连接

File c:\Users\29252\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\utils\traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
     67     filtered_tb = _process_traceback_frames(e.__traceback__)
     68     # To get the full stack trace, call:
     69     # `tf.debugging.disable_traceback_filtering()`
---> 70     raise e.with_traceback(filtered_tb) from None
     71 finally:
     72     del filtered_tb

Cell In[105], line 31, in func_layer(tensors)
     27 def func_layer(tensors):
     28     # 使用 Tensorflow 在 Lambda 层中实现 func 函数，现在接受 x 和 k 作为输入
     29     x, k = tensors
---> 31     return func(x, k)

Cell In[105], line 18, in func(x, k)
     16 def func(x, k):
     17     # 你的实际函数，现在同时接受 x 和 k 作为输入
---> 18     t,cx_t,cs_t,cp_t = x
     19     t, cx_t, cs_t, cp_t = tf.unstack(t,cx_t,cs_t,cp_t, axis=1)
     20     alpha, beta, gamma, = k

OperatorNotAllowedInGraphError: Exception encountered when calling layer "lambda_4" (type Lambda).

Iterating over a symbolic `tf.Tensor` is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.

Call arguments received by layer "lambda_4" (type Lambda):
  • inputs=['tf.Tensor(shape=(None, 4), dtype=float32)', 'tf.Tensor(shape=(None, 3), dtype=float32)']
  • mask=None
  • training=None