当前位置:网站首页>Solve cannot import name 'multiheadattention' from 'tensorflow keras. layers‘
Solve cannot import name 'multiheadattention' from 'tensorflow keras. layers‘
2022-06-11 08:01:00 【sinysama】
Here's the catalog title
One 、keras Of MultiHeadAttention Import API Report the wrong question
Can't introduce MultiHeadAttention
Import package :
from tensorflow.keras.layers import MultiHeadAttention
then run Report a mistake later
cannot import name ‘MultiHeadAttention’ from 'tensorflow.keras.layers’
Two 、 Analyze the error reporting configuration
Inquire about keras Official website 
introduce MultiHeadAttention, Found an error , Three attention mechanism layers are given in the official website , The other two can be introduced normally . Tried tensorflow2.1 and 2.3, All lack interfaces .
A temporary solution
pip install keras-multi-head
However, this is keras Methods , What we use more often is tf.keras(tensorflow2.0 The above ).
Estimated yes tensorflow Version and other issues . Try , Sure enough .
Final solution
Just replace tensorflow2.5 You can import the version successfully ( •̀ ω •́ )y
So it is tensorflow Version of the problem , In order to speed up efficiency , It is directly given here tensorflow2.5 Installation configuration ( Clickable )
| Configuration items | edition |
|---|---|
| python | 3.6-3.9 |
| Tensorflow(CPU/GPU) | 2.5.0 |
| Cuda(GPU Version required ) | 11.2 |
| Cudnn(GPU Version required ) | v 8.0.5 |
边栏推荐
- Black Qunhui dsm7.0.1 physical machine installation tutorial
- Remote office experience | community essay solicitation
- Detailed explanation of shift operator and bit operator in C language
- Selenium click the floating menu and realize the functions of right mouse button
- Collation of basic knowledge of intermediate development of Andrews (for interview)
- Understanding of Poisson distribution and Poisson process and Erlang distribution and their relations (important theories in queuing theory and operational research)
- Activity中,View#postDelay会导致内存泄漏,但是不会影响Activity的生命周期执行。
- Layout of code setting constraintlayout_ constraintDimensionRatio
- 运筹学导论
- 代码设置ConstraintLayout的layout_constraintDimensionRatio
猜你喜欢

Record a murder case caused by ignoring the @suppresslint ("newapi") prompt

The solution of "no startup device" after running Bochs

TiDB Cloud 上線 Google Cloud Marketplace,以全新一棧式實時 HTAP 數據庫賦能全球開發者

Printing diamond of beginner C

Using Tkinter to realize guessing numbers game

Zero foundation self-study SQL course | union joint query

Magnifying mirror rendering

【案例解读】医疗单据OCR识别助力健康险智能理赔

Data visualization and Matplotlib

Development of sylixos SD device driver
随机推荐
Simple use of string
用 Keras/TensorFlow 2.9 创建深度学习模型的方法总结
Layout of code setting constraintlayout_ constraintDimensionRatio
TypeScript-枚举
Sort - Swap sort
Session and session management technology
嵌入式软件面试问题总结
2021-10-17
Typescript keyboard mapping
How to find the complementary sequence of digraph
运筹学导论
C. Managing history (greedy / hashing / thinking / good questions)
使用特殊字符拼接字符串“+“
如何做好空状态设计?来看这份全面总结
(transformation) tree, binary tree and forest transformation principle
签到体系设计:签到功能该怎么画
使用 COCO 数据集训练 YOLOv4-CSP 模型
【 史上最全的ENSP【安装图解】!】
Getting started with bladed tutorial (video)
C- print 99 multiplication table