小编rob*_*rob的帖子

解决调用层“tf.keras.backend.rnn_1”时的 Keras TypeError 限制

我正在尝试使用 Keras 作为使用 LSTM 网络的机器翻译中的注意机制。

但是,我在代码中遇到 TypeError 异常。

TypeError: Exception encountered when calling layer "tf.keras.backend.rnn_1" (type TFOpLambda).

You are passing KerasTensor(type_spec=TensorSpec(shape=(None, 35), dtype=tf.float32, name=None), name='tf.compat.v1.nn.softmax_3/Softmax:0', description="created by layer 'tf.compat.v1.nn.softmax_3'"), an intermediate Keras symbolic input/output, to a TF API that does not allow registering custom dispatchers, such as `tf.cond`, `tf.function`, gradient tapes, or `tf.map_fn`. Keras Functional model construction only supports TF API calls that *do* support dispatching, such as `tf.math.add` or `tf.reshape`. Other APIs cannot be called directly on symbolic Kerasinputs/outputs. …
Run Code Online (Sandbox Code Playgroud)

python deep-learning lstm keras tensorflow

5
推荐指数
1
解决办法
3527
查看次数

标签 统计

deep-learning ×1

keras ×1

lstm ×1

python ×1

tensorflow ×1