【发布时间】:2019-09-09 16:40:27
【问题描述】:
当我写tf.keras.layers.LSTM 时,我收到警告
Note that this layer is not optimized for performance. Please use tf.keras.layers.CuDNNLSTM for better performance on GPU.
但是当我将图层更改为tf.keras.layers.CuDNNLSTM 时,我得到了错误
AttributeError: module 'tensorflow.python.keras.api._v2.keras.layers' has no attribute 'CuDNNLSTM'
Tensorflow 版本是 2.0.0-alpha0,Keras 版本是 2.2.4-tf。
我该如何解决这个问题?
【问题讨论】:
-
tf 2.0中还没有CuDNNLSTM层。在此处查看可用层tensorflow.org/versions/r2.0/api_docs/python/tf/keras/layers -
使用
tf.compat.v1.keras.layers.CuDNNLSTM(),而不是tf.keras.layers.CuDNNLSTM()
标签: python tensorflow keras deep-learning