当前位置:网站首页>torch.nn.Transformer导入失败
torch.nn.Transformer导入失败
2022-06-28 21:56:00 【Cyril_KI】
方法一
直接使用最原始的方式导入:
from torch.nn.modules.transformer import Transformer, TransformerEncoder, TransformerDecoder, \
TransformerEncoderLayer, TransformerDecoderLayer
方法二
在torch.nn.modules文件夹下新建一个_init_.pyi文件,然后写入这段语句:
from .transformer import TransformerEncoder as TransformerEncoder, TransformerDecoder as TransformerDecoder, \
TransformerEncoderLayer as TransformerEncoderLayer, TransformerDecoderLayer as TransformerDecoderLayer, \
Transformer as Transformer
此时就可以正常使用:
from torch.nn import Transformer, TransformerEncoder, TransformerDecoder, \
TransformerEncoderLayer, TransformerDecoderLayer
边栏推荐
- Binomial distribution (a discrete distribution)
- Constructing the three-dimensional anti penetration of the actual combat defense system
- 职业问诊 | 面试时被问到职业规划该怎么回答?
- Ctrip will push the "3+2" working mode: 3 days a week on duty and 2 days of free choice of office space. Do you envy it?
- VR全景制作的前景如何?
- ansible生产环境使用场景(七):批量部署elk客户端
- 现在还能入“坑”数据分析吗?看看2022年数据分析热门岗位!
- ADB regular use of work notes
- 在亿学学堂开通证券账户是安全可靠的吗?
- After reading the list of global patent and chip buyers, I understand that high innovation can lead to high profits
猜你喜欢

Multinomial distribution (a discrete distribution)

零基础自学SQL课程 | SQL中的日期函数大全

docker下载Mysql镜像创建数据库链接时候发生密码错误问题

直播预告|SQL也能玩转工业级机器学习?MLOps meetup V3带你一探究竟!

Gross vs60 billion. Is food safety the biggest obstacle to Weilong's listing?

Deploy grafana to realize graphical monitoring

PHP login problem

Zadig 构建究竟何强大?一起来实践

The example application of histogram in data visualization makes the public performance results clear at a glance

Analysis of CSRF Cross Site Request Forgery vulnerability
随机推荐
Pat 1054 the dominiant color (20 points)
Is the VIP securities account of qiniu school really safe and regular? How do I say this?
16 `bs对象.节点名div.属性contents` children descendants 获取子节点 子孙节点
Native implementation Net 5.0+ custom log
这个简单的小功能,半年为我们产研团队省下213个小时
犹豫的根音
Safety innovation practice | Haitai Fangyuan was invited to participate in the technical exchange Seminar on "network information innovation and value co creation in the digital age"
JS array common methods
河狸生存记:90后女博士与AI开发者们
[golang] leetcode intermediate subset & Word Search
Hashicorp/raft introduction and source code analysis (III): introduction to cluster node recovery
PAT 1021. Traversal of the deep root (25 points) graph, DFS, calculating the number of connected components
Use of dynamic panels
职场人调研报告:裸辞占比最高的居然是中年人
How to make up the PMP Exam? How much is the make-up exam?
Rule engine development experience sharing - reddit
go-cryptobin 常用加密解密库
职业问诊 | 面试时被问到职业规划该怎么回答?
加刚干的前提
场景化接口开发利器,金蝶云苍穹新版OpenAPI引擎来了!