简体   繁体   English

从 keras.layers 导入 LayerNormalization 时出错

[英]Error when importing LayerNormalization from keras.layers

I would like to use LayerNormalization, which is documented here: https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/layers/LayerNormalization我想使用 LayerNormalization,这里有记录: https ://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/layers/LayerNormalization

When I import the module当我导入模块时

from tensorflow.python.keras.layers import LayerNormalization

then I get the following Exception:然后我得到以下异常:

Exception has occurred: ImportError
cannot import name 'LayerNormalization' from 'tensorflow.keras.layers'

My keras version is 2.3.1 and my tensorflow version is 1.13.1.我的 keras 版本是 2.3.1,我的 tensorflow 版本是 1.13.1。

Can someone help me?有人能帮我吗?

这是因为您的 TF 版本将其升级到 1.15 或 2.0 可以正常工作,请参阅此colab笔记本。

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

相关问题 如何从 Keras.layers 实现 Merge - How to implement Merge from Keras.layers 导入错误:无法从 'tensorflow.python.keras.layers.normalization' 导入名称 'LayerNormalization',在 colab 上出现此错误? - ImportError: cannot import name 'LayerNormalization' from 'tensorflow.python.keras.layers.normalization' , getting this error on colab? 无法从“keras.layers”导入名称“Merge” - Cannot import name 'Merge' from 'keras.layers' from keras.layers import Dense -- 无法导入名称“Dense” - from keras.layers import Dense -- cannot import name 'Dense' 无法从“keras.layers”导入名称“Deconvolution2D” - cannot import name 'Deconvolution2D' from 'keras.layers' 模块 'keras.layers' 没有属性 'experimental' - module 'keras.layers' has no attribute 'experimental' keras.layers 中 model 架构中的无效语法 - Invalid syntax in model architecture in keras.layers tensorflow.keras.layers 和 keras.layers 有什么区别? - What is the difference between tensorflow.keras.layers and keras.layers? 什么是 keras.layers 与 keras.layers.core? - What is keras.layers vs keras.layers.core? ImportError:无法从“tensorflow.python.keras.layers.normalization”导入名称“LayerNormalization” - ImportError: cannot import name 'LayerNormalization' from 'tensorflow.python.keras.layers.normalization'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM