AttributeError: 'Sequential' object has no attribute 'run_eagerly
时间: 2023-10-25 13:09:26 浏览: 125
This error occurs when trying to use the `run_eagerly` method on a TensorFlow `Sequential` object. The `run_eagerly` method is used to enable eager execution, which is a mode of TensorFlow where operations are executed immediately as they are called, rather than being added to a computational graph to be executed later.
However, the `Sequential` object does not have a `run_eagerly` method, as it is a high-level API for building and training neural networks using TensorFlow. Instead, you can enable eager execution globally by calling `tf.config.experimental_run_functions_eagerly(True)` before defining and training your model.
Alternatively, you can use a lower-level API such as `tf.keras.Model` or `tf.keras.layers.Layer` to build your model, which do have a `run_eagerly` method.
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)