简体   繁体   English

模块“tensorflow.python.keras.api._v2.keras.layers”没有属性“CuDNNLSTM”

[英]module 'tensorflow.python.keras.api._v2.keras.layers' has no attribute 'CuDNNLSTM'

When I write tf.keras.layers.LSTM , I get the warning当我写tf.keras.layers.LSTM时,我收到警告

Note that this layer is not optimized for performance. Please use tf.keras.layers.CuDNNLSTM for better performance on GPU.

But when I change the layer to tf.keras.layers.CuDNNLSTM , I get the error但是当我将层更改为tf.keras.layers.CuDNNLSTM时,出现错误

AttributeError: module 'tensorflow.python.keras.api._v2.keras.layers' has no attribute 'CuDNNLSTM'

Tensorflow version is 2.0.0-alpha0, Keras version is 2.2.4-tf. Tensorflow 版本为 2.0.0-alpha0,Keras 版本为 2.2.4-tf。

How can I fix this problem?我该如何解决这个问题?

In general, in TensorFlow 2.0 we should just use:一般来说,在 TensorFlow 2.0 中我们应该只使用:

tf.keras.layers.LSTM

which, despite the warning, will use the GPU.尽管有警告,它仍将使用 GPU。

The warning message incorrectly existed in the 2.0.0-alpha0 version but has since been removed in 2.0.0-beta1该警告消息错误地存在于2.0.0-alpha0版本中,但已在2.0.0-beta1中删除

If for some reason you specifically need the original implementation of tf.keras.layers.CuDNNLSTM then you can use tf.compat.v1.keras.layers.CuDNNLSTM but this would be an edge case.如果出于某种原因您特别需要tf.keras.layers.CuDNNLSTM的原始实现,那么您可以使用tf.compat.v1.keras.layers.CuDNNLSTM但这将是一种边缘情况。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 tensorflow keras:我收到此错误“模块“tensorflow._api.v1.keras.layers”没有属性“flatten” - tensorflow keras: I am getting this error 'module "tensorflow._api.v1.keras.layers' has no attribute 'flatten'" AttributeError: tensorflow_core.python.keras.api._v2.keras.layers.experimental' has no attribute 'SyncBatchNormalization' - AttributeError: tensorflow_core.python.keras.api._v2.keras.layers.experimental' has no attribute 'SyncBatchNormalization' AttributeError:模块“tensorflow_core.python.keras.api._v2.keras.activations”没有属性“swish” - AttributeError: module 'tensorflow_core.python.keras.api._v2.keras.activations' has no attribute 'swish' AttributeError:模块“tensorflow_core.python.keras.api._v2.keras.losses”没有属性“softmax_cross_entropy” - AttributeError: module 'tensorflow_core.python.keras.api._v2.keras.losses' has no attribute 'softmax_cross_entropy' 我该如何解决这个问题:AttributeError:模块'tensorflow_core.python.keras.api._v2.keras'没有属性'Dense' - how can i fix this : AttributeError: module 'tensorflow_core.python.keras.api._v2.keras' has no attribute 'Dense' 模块“keras.api._v2.keras”没有属性“模型” - module 'keras.api._v2.keras' has no attribute 'model' AttributeError: module 'tensorflow' has no attribute 'python' in Keras Tensorflow - AttributeError: module 'tensorflow' has no attribute 'python' in Keras Tensorflow 模块 'keras.layers' 没有属性 'experimental' - module 'keras.layers' has no attribute 'experimental' _api/v1/keras/ 和 python/keras 之间的 tensorflow/keras utils 模块混淆 - tensorflow/keras utils module confusion between _api/v1/keras/ and python/keras 模块'tensorflow.python.keras.backend'没有属性'slice'? - module 'tensorflow.python.keras.backend' has no attribute 'slice'?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM