当前位置:网站首页>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
边栏推荐
- Security dilemma of NFT liquidity agreement - Analysis of the hacked event of NFT loan agreement xcarnival
- flutter通过 GlobalKey 获取界面任意元素坐标尺寸
- MSCI 2022年市场分类评估
- 电商秒杀系统架构设计
- 河狸生存记:90后女博士与AI开发者们
- ADB regular use of work notes
- Is it safe to open a stock trading account? Is it reliable?
- 10、标准I/O输入输出重定向及管道
- GO语言-反射reflect
- 零基础自学SQL课程 | SQL中的日期函数大全
猜你喜欢

After reading the list of global patent and chip buyers, I understand that high innovation can lead to high profits

Zadig + SonarQube,为开发过程安全保驾

F1tenth gym of ROS 2 humble hawksbill

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"

Survival of beaver: post-90s female doctors and AI developers

GO语言-反射reflect

YAYA LIVE CTO 唐鸿斌:真正本地化,要让产品没有「产地」属性

硬件开发笔记(七): 硬件开发基本流程,制作一个USB转RS232的模块(六):创建0603封装并关联原理图元器件

Construction and application of urban brain knowledge map

什么是低代码开发?
随机推荐
杆会睡不着觉
Use of axurer9 option group
Progress in visual weakly supervised learning
PHP自学Go日记(四):GO的变量声明方式
Why use the rust language?
MSCI 2022年市场分类评估
[webapi] return dynamic list dynamic
科技巨头成立元宇宙标准论坛,走向开放还是建立围城?
职业问诊 | 在数据分析面试中,这样做自我介绍才靠谱
Lua源码剖析:一. lua变量类型可变特性在C代码中实现。
【selenium自动化过程中的api抓包】browsermobproxy的安装和配置
Webrtc audio and video development - experience
GO语言-反射reflect
为什么要使用 Rust 语言?
How to make up the PMP Exam? How much is the make-up exam?
How can the sports app keep the end-to-side background alive to make the sports record more complete?
硬件开发笔记(七): 硬件开发基本流程,制作一个USB转RS232的模块(六):创建0603封装并关联原理图元器件
Is the VIP securities account of qiniu school really safe and regular? How do I say this?
ADB regular use of work notes
Rule engine development experience sharing - reddit