当前位置:网站首页>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
边栏推荐
- Hyperjumptech/grule-rule-engine: rule engine implementation of golang
- 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"
- Appium automated test Jiugongge unlock
- 什么是低代码开发?
- 加刚干的前提
- Is it safe to open an account on great wisdom
- 给朋友的忠告
- 软件测试的三个沟通技巧
- 安全 创新 实践|海泰方圆受邀参加“数字时代的网信创新与价值共创”技术交流研讨会
- 重磅!CDA认证考试备考答疑上线
猜你喜欢

别再问我,UI自动化测试怎么做了……

【selenium自动化过程中的api抓包】browsermobproxy的安装和配置

初识阿里云(云计算)—发展历程和技术架构、地域和可用区!

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

Un voyage profond d'IA dans Huawei Cloud

共探数字技术与信息安全,第四届中俄数字论坛成功举办

17 `bs对象.节点名h3.parent` parents 获取父节点 祖先节点

Architecture design of e-commerce secsha system

Live broadcast preview | can SQL also play industrial machine learning? Mlops meetup V3 takes you to the bottom!

Hardware development notes (VII): basic process of hardware development, making a USB to RS232 module (VI): creating 0603 package and associating principle graphic devices
随机推荐
How do independent site sellers efficiently manage complex Facebook pages?
[linq]c list type grouping sum
Pat 1054 the dominiant color (20 points)
Is the VIP securities account of qiniu school really safe and regular? How do I say this?
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"
犹豫的根音
The example application of histogram in data visualization makes the public performance results clear at a glance
SQLSERVER sys. Escape of parameter placeholders in messages
10、标准I/O输入输出重定向及管道
IPv6 comprehensive experiment
【HackTheBox】 meow
C#/VB. Net to convert PDF to excel
E-commerce is popular, how to improve the store conversion rate?
Sword finger offer:[day 2 linked list (simple)] --- > print the linked list from end to end
PAT 1021. Traversal of the deep root (25 points) graph, DFS, calculating the number of connected components
F1tenth gym of ROS 2 humble hawksbill
河狸生存记:90后女博士与AI开发者们
职业问诊 | 在数据分析面试中,这样做自我介绍才靠谱
[linq] execute SQL like in statements using EF to LINQ
To be a cross-border e-commerce, you must learn to use PRA software, free your hands and improve efficiency!