python - 从 Keras 调用方法 timeseries_dataset_from_array 时出错

标签 python tensorflow keras

我正在阅读以下教程:
https://www.tensorflow.org/tutorials/structured_data/time_series
有趣的是,当我运行代码时出现错误:AttributeError: module 'tensorflow_core.keras.preprocessing' has no attribute 'timeseries_dataset_from_array'我尝试显式导入方法,如:from tensorflow.keras.preprocessing import timeseries_dataset_from_array但是之后:ImportError: cannot import name 'timeseries_dataset_from_array'我使用的是 Spyder 4、Python 3.6.9、TensorFlow 2.1.0 和 Keras 2.2.4-tf。任何人都可以向我澄清这一点吗?

最佳答案

我认为它是在 tensorflow 2.3.0 中引入的,所以你需要更新你的 tensorflow。
tf.keras.preprocessing.timeseries_dataset_from_array

关于python - 从 Keras 调用方法 timeseries_dataset_from_array 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63350484/

相关文章:

python - 在 pydev 中使用 unittest 在 Python 中对整个项目层次结构进行单元测试

python - Tensorflow 中的基本添加?

tensorflow - 如何控制 tensorflow 估计器保留的检查点数量?

image-processing - 如何将CNN应用于基于多 channel 像素数据的每个 channel 的权重?

python - 使用 Celery 2.6.0rc5 时出现 TypeError

python - 在 TensorFlow 中使用 3D 卷积进行批量归一化

python - 如何从谷歌预训练的word2vec模型中提取词向量?

python - 同时使用 pytest 和 tf.test.TestCase 的问题

python - 即使我使用相同的层模块构建完全相同的模型,Tensorflow 和 Keras 显示的结果略有不同

python - 每次训练keras模型后的结果都不同