当前位置:网站首页>【解决方案】PaddlePaddle 2.x调用静态图模式
【解决方案】PaddlePaddle 2.x调用静态图模式
2022-07-04 19:28:00 【Allenpandas】
问题分析
In PaddlePaddle 2.x, we turn on dynamic graph mode by default, and '%s()' is only supported in static graph mode. So if you want to use this api, please call 'paddle.enable_static()' before this api to enter static graph mode." % func.__name__
AssertionError:
In PaddlePaddle 2.x, we turn on dynamic graph mode by default, and 'data()' is only supported in static graph mode. So if you want to use this api, please call 'paddle.enable_static()' before this api to enter static graph mode.
问题说在PaddlePaddle包的2.X版本中,默认是启动动态图模式的。但是data()
和%s
只能在静态图模式下被支持,如果想调用这个api的话,必须在调用api之前添加paddle.enable_static()
这一行代码。
解决方案
# 导入paddlepaddle包
import paddle
# 紧跟着开启静态图模式
paddle.enable_static()
边栏推荐
- Understand Alibaba cloud's secret weapon "dragon architecture" in the article "science popularization talent"
- How to adapt your games to different sizes of mobile screen
- 剑指 Offer II 80-100(持续更新)
- 电脑怎么保存网页到桌面上使用
- GVM use
- 长城证券开户安全吗 股票开户流程网上开户
- Idea plug-in
- Understand the reading, writing and creation of files in go language
- What is the development of block hash quiz game system? Hash quiz game system development (case mature)
- Lingyun going to sea | Wenhua online & Huawei cloud: creating a new solution for smart teaching in Africa
猜你喜欢
针对深度学习的“失忆症”,科学家提出基于相似性加权交错学习,登上PNAS
《动手学深度学习》(三) -- 卷积神经网络 CNN
Common verification rules of form components -1 (continuously updating ~)
Flet tutorial 06 basic introduction to textbutton (tutorial includes source code)
Automatic generation of interface automatic test cases by actual operation
Win11共享文件打不开怎么办?Win11共享文件打不开的解决方法
Related concepts of federal learning and motivation (1)
Win11系统wifi总掉线怎么办?Win11系统wifi总掉线的解决方法
工厂从自动化到数字孪生,图扑能干什么?
伦敦银走势图分析的新方法
随机推荐
See how Tencent does interface automation testing
Win11无法将值写入注册表项如何解决?
《动手学深度学习》(三) -- 卷积神经网络 CNN
最长的可整合子数组的长度
[in-depth learning] review pytoch's 19 loss functions
Record the online bug solving list (unfinished to be continued 7/4)
Win11怎么搜索无线显示器?Win11查找无线显示器设备的方法
Function analysis and source code of hash guessing game system development
What if win11u disk refuses access? An effective solution to win11u disk access denial
黄金k线图中的三角形有几种?
科普达人丨一文看懂阿里云的秘密武器“神龙架构”
Stack: how to realize the judgment of valid brackets?
LeetCode+ 81 - 85 单调栈专题
GVM使用
What if the win11 shared file cannot be opened? The solution of win11 shared file cannot be opened
idea大小写快捷键
FS8B711S14电动红酒开瓶器单片机IC方案开发专用集成IC
什么叫内卷?
一文搞懂Go语言中文件的读写与创建
WinCC7.5 SP1如何通过交叉索引来寻找变量及其位置?