Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c4204bbf
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
c4204bbf
编写于
8月 01, 2023
作者:
W
wanghuancoder
提交者:
GitHub
8月 01, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test close trace (#55787)
* test close old dygraph trace
上级
4ddd6154
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
1 addition
and
127 deletion
+1
-127
paddle/fluid/pybind/imperative.cc
paddle/fluid/pybind/imperative.cc
+0
-110
python/paddle/fluid/dygraph/tracer.py
python/paddle/fluid/dygraph/tracer.py
+1
-17
未找到文件。
paddle/fluid/pybind/imperative.cc
浏览文件 @
c4204bbf
...
...
@@ -2284,116 +2284,6 @@ void BindImperative(py::module *m_ptr) {
return
std
::
make_tuple
(
kernelsig_ins
,
kernelsig_attrs
,
kernelsig_outs
);
}
})
.
def
(
"trace"
,
[](
imperative
::
Tracer
&
self
,
const
std
::
string
&
type
,
const
PyNameVarBaseMap
&
ins
,
const
PyNameVarBaseMap
&
outs
,
framework
::
AttributeMap
attrs
,
const
platform
::
CustomPlace
&
place
,
bool
trace_backward
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
inplace_map
=
{})
{
auto
ins_map
=
ConvertToNameVarBaseMap
(
ins
);
auto
outs_map
=
ConvertToNameVarBaseMap
(
outs
);
{
py
::
gil_scoped_release
release
;
self
.
TraceOp
<
imperative
::
VarBase
>
(
type
,
std
::
move
(
ins_map
),
std
::
move
(
outs_map
),
std
::
move
(
attrs
),
place
,
trace_backward
,
inplace_map
);
}
})
.
def
(
"trace"
,
[](
imperative
::
Tracer
&
self
,
const
std
::
string
&
type
,
const
PyNameVarBaseMap
&
ins
,
const
PyNameVarBaseMap
&
outs
,
framework
::
AttributeMap
attrs
,
const
platform
::
XPUPlace
&
place
,
bool
trace_backward
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
inplace_map
=
{})
{
auto
ins_map
=
ConvertToNameVarBaseMap
(
ins
);
auto
outs_map
=
ConvertToNameVarBaseMap
(
outs
);
{
py
::
gil_scoped_release
release
;
self
.
TraceOp
<
imperative
::
VarBase
>
(
type
,
std
::
move
(
ins_map
),
std
::
move
(
outs_map
),
std
::
move
(
attrs
),
place
,
trace_backward
,
inplace_map
);
}
})
.
def
(
"trace"
,
[](
imperative
::
Tracer
&
self
,
const
std
::
string
&
type
,
const
PyNameVarBaseMap
&
ins
,
const
PyNameVarBaseMap
&
outs
,
framework
::
AttributeMap
attrs
,
const
platform
::
CUDAPlace
&
place
,
bool
trace_backward
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
inplace_map
=
{})
{
auto
ins_map
=
ConvertToNameVarBaseMap
(
ins
);
auto
outs_map
=
ConvertToNameVarBaseMap
(
outs
);
{
py
::
gil_scoped_release
release
;
self
.
TraceOp
<
imperative
::
VarBase
>
(
type
,
std
::
move
(
ins_map
),
std
::
move
(
outs_map
),
std
::
move
(
attrs
),
place
,
trace_backward
,
inplace_map
);
}
})
.
def
(
"trace"
,
[](
imperative
::
Tracer
&
self
,
const
std
::
string
&
type
,
const
PyNameVarBaseMap
&
ins
,
const
PyNameVarBaseMap
&
outs
,
framework
::
AttributeMap
attrs
,
const
platform
::
IPUPlace
&
place
,
bool
trace_backward
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
inplace_map
=
{})
{
auto
ins_map
=
ConvertToNameVarBaseMap
(
ins
);
auto
outs_map
=
ConvertToNameVarBaseMap
(
outs
);
{
py
::
gil_scoped_release
release
;
self
.
TraceOp
<
imperative
::
VarBase
>
(
type
,
std
::
move
(
ins_map
),
std
::
move
(
outs_map
),
std
::
move
(
attrs
),
place
,
trace_backward
,
inplace_map
);
}
})
.
def
(
"trace"
,
[](
imperative
::
Tracer
&
self
,
const
std
::
string
&
type
,
const
PyNameVarBaseMap
&
ins
,
const
PyNameVarBaseMap
&
outs
,
framework
::
AttributeMap
attrs
,
const
platform
::
CPUPlace
&
place
,
bool
trace_backward
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
inplace_map
=
{})
{
auto
ins_map
=
ConvertToNameVarBaseMap
(
ins
);
auto
outs_map
=
ConvertToNameVarBaseMap
(
outs
);
{
py
::
gil_scoped_release
release
;
self
.
TraceOp
<
imperative
::
VarBase
>
(
type
,
std
::
move
(
ins_map
),
std
::
move
(
outs_map
),
std
::
move
(
attrs
),
place
,
trace_backward
,
inplace_map
);
}
});
// define parallel context
...
...
python/paddle/fluid/dygraph/tracer.py
浏览文件 @
c4204bbf
...
...
@@ -324,23 +324,7 @@ class Tracer(core.Tracer):
type
,
inputs
,
outputs
,
attrs
,
stop_gradient
,
inplace_map
)
else
:
# this block is used to convert attrs according to the opproto
# since `trace` handles AttributeMap directly, without other
# modification to the passed attribute map, so we change it before
# `trace`
if
framework
.
OpProtoHolder
.
instance
().
has_op_proto
(
type
):
proto
=
framework
.
OpProtoHolder
.
instance
().
get_op_proto
(
type
)
attrs
=
framework
.
canonicalize_attrs
(
attrs
,
proto
)
self
.
trace
(
type
,
inputs
,
outputs
,
attrs
,
framework
.
_current_expected_place
(),
self
.
_has_grad
and
not
stop_gradient
,
inplace_map
if
inplace_map
else
{},
)
raise
ValueError
(
"trace_op only work in dygraph mode"
)
def
train_mode
(
self
):
self
.
_train_mode
=
True
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录