Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
980292c2
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
980292c2
编写于
9月 23, 2022
作者:
X
xiongkun
提交者:
GitHub
9月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug in convert call: tranform the static func. (#46278) (#46365)
上级
6a508334
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
1 deletion
+5
-1
python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py
...dle/fluid/dygraph/dygraph_to_static/program_translator.py
+4
-1
python/paddle/fluid/dygraph/dygraph_to_static/utils.py
python/paddle/fluid/dygraph/dygraph_to_static/utils.py
+1
-0
未找到文件。
python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py
浏览文件 @
980292c2
...
@@ -42,7 +42,7 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import func_to_source_code
...
@@ -42,7 +42,7 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import func_to_source_code
from
paddle.fluid.dygraph.dygraph_to_static.utils
import
input_specs_compatible
from
paddle.fluid.dygraph.dygraph_to_static.utils
import
input_specs_compatible
from
paddle.fluid.dygraph.dygraph_to_static.utils
import
type_name
from
paddle.fluid.dygraph.dygraph_to_static.utils
import
type_name
from
paddle.fluid.dygraph.dygraph_to_static.utils
import
unwrap
from
paddle.fluid.dygraph.dygraph_to_static.utils
import
unwrap
from
paddle.fluid.dygraph.dygraph_to_static.utils
import
make_hashable
from
paddle.fluid.dygraph.dygraph_to_static.utils
import
make_hashable
,
ALREADY_D2S
from
paddle.fluid.dygraph.dygraph_to_static.function_spec
import
FunctionSpec
,
_hash_spec_names
from
paddle.fluid.dygraph.dygraph_to_static.function_spec
import
FunctionSpec
,
_hash_spec_names
from
paddle.fluid.dygraph.dygraph_to_static.function_spec
import
get_buffers
,
get_parameters
from
paddle.fluid.dygraph.dygraph_to_static.function_spec
import
get_buffers
,
get_parameters
from
paddle.fluid.wrapped_decorator
import
signature_safe_contextmanager
from
paddle.fluid.wrapped_decorator
import
signature_safe_contextmanager
...
@@ -136,8 +136,11 @@ def convert_to_static(function):
...
@@ -136,8 +136,11 @@ def convert_to_static(function):
Args:
Args:
function(callable): The function with dygraph layers that will be converted into static layers.
function(callable): The function with dygraph layers that will be converted into static layers.
"""
"""
if
getattr
(
function
,
ALREADY_D2S
,
None
):
return
function
with
_CACHE_LOCK
:
with
_CACHE_LOCK
:
static_func
=
_FUNCTION_CACHE
.
convert_with_cache
(
function
)
static_func
=
_FUNCTION_CACHE
.
convert_with_cache
(
function
)
setattr
(
static_func
,
ALREADY_D2S
,
True
)
return
static_func
return
static_func
...
...
python/paddle/fluid/dygraph/dygraph_to_static/utils.py
浏览文件 @
980292c2
...
@@ -44,6 +44,7 @@ DYGRAPH_MODULE_PREFIX = 'paddle.fluid.dygraph'
...
@@ -44,6 +44,7 @@ DYGRAPH_MODULE_PREFIX = 'paddle.fluid.dygraph'
DYGRAPH_TO_STATIC_MODULE_PREFIX
=
'paddle.fluid.dygraph.dygraph_to_static'
DYGRAPH_TO_STATIC_MODULE_PREFIX
=
'paddle.fluid.dygraph.dygraph_to_static'
GET_ARGS_FUNC_PREFIX
=
'get_args'
GET_ARGS_FUNC_PREFIX
=
'get_args'
SET_ARGS_FUNC_PREFIX
=
'set_args'
SET_ARGS_FUNC_PREFIX
=
'set_args'
ALREADY_D2S
=
'__already_d2s'
ARGS_NAME
=
'__args'
ARGS_NAME
=
'__args'
# NOTE(liym27): Please use `getattr(ast_node, ORIGI_INFO)` instead of . operation to get the original information of ast node.
# NOTE(liym27): Please use `getattr(ast_node, ORIGI_INFO)` instead of . operation to get the original information of ast node.
ORIGI_INFO
=
"Original information of source code for ast node."
ORIGI_INFO
=
"Original information of source code for ast node."
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录