Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
0bf809c9
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
提交
0bf809c9
编写于
2月 25, 2019
作者:
Z
Zhen Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add set_attr for IrOpNode. test=develop
上级
7c8f7df2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
2 deletion
+30
-2
paddle/fluid/platform/CMakeLists.txt
paddle/fluid/platform/CMakeLists.txt
+1
-1
python/paddle/fluid/framework.py
python/paddle/fluid/framework.py
+29
-1
未找到文件。
paddle/fluid/platform/CMakeLists.txt
浏览文件 @
0bf809c9
...
@@ -87,7 +87,7 @@ nv_test(transform_test SRCS transform_test.cu DEPS memory place device_context)
...
@@ -87,7 +87,7 @@ nv_test(transform_test SRCS transform_test.cu DEPS memory place device_context)
cc_library
(
timer SRCS timer.cc
)
cc_library
(
timer SRCS timer.cc
)
cc_test
(
timer_test SRCS timer_test.cc DEPS timer
)
cc_test
(
timer_test SRCS timer_test.cc DEPS timer
)
cc_library
(
device_tracer SRCS device_tracer.cc DEPS boost profiler_proto framework_proto
device_context
${
GPU_CTX_DEPS
}
)
cc_library
(
device_tracer SRCS device_tracer.cc DEPS boost profiler_proto framework_proto
${
GPU_CTX_DEPS
}
)
if
(
WITH_GPU
)
if
(
WITH_GPU
)
nv_library
(
profiler SRCS profiler.cc profiler.cu DEPS device_context device_tracer
)
nv_library
(
profiler SRCS profiler.cc profiler.cu DEPS device_context device_tracer
)
else
()
else
()
...
...
python/paddle/fluid/framework.py
浏览文件 @
0bf809c9
...
@@ -1633,7 +1633,7 @@ class IrNode(object):
...
@@ -1633,7 +1633,7 @@ class IrNode(object):
"""
"""
self
.
node
.
clear_inputs
()
self
.
node
.
clear_inputs
()
def
inputs_remove
_by_id
(
self
,
node_id
):
def
remove_input
_by_id
(
self
,
node_id
):
"""
"""
Remove a node from inputs by the given node id.
Remove a node from inputs by the given node id.
...
@@ -1876,6 +1876,34 @@ class IrOpNode(IrNode):
...
@@ -1876,6 +1876,34 @@ class IrOpNode(IrNode):
"The node operator description cannot be None."
"The node operator description cannot be None."
return
self
.
node
.
op
().
set_type
(
new_type
)
return
self
.
node
.
op
().
set_type
(
new_type
)
def
set_attr
(
self
,
name
,
val
):
"""
Set the value of attribute by attribute's name.
Args:
name(str): the attribute name.
val(bool|int|str|float|list): the value of the attribute.
"""
self
.
_update_desc_attr
(
name
,
val
)
def
_update_desc_attr
(
self
,
name
,
val
):
"""
Update the value of the op desc's attribute by attribute's name.
"""
assert
self
.
node
.
op
()
is
not
None
,
\
"The node operator description cannot be None."
desc
=
self
.
node
.
op
()
if
isinstance
(
val
,
Block
):
desc
.
set_block_attr
(
name
,
val
.
desc
)
elif
isinstance
(
val
,
list
)
and
val
and
\
all
(
isinstance
(
v
,
Block
)
for
v
in
val
):
desc
.
set_blocks_attr
(
name
,
[
v
.
desc
for
v
in
val
])
elif
isinstance
(
val
,
core
.
BlockDesc
)
or
\
isinstance
(
val
,
core
.
ProgramDesc
):
desc
.
set_serialized_attr
(
name
,
val
.
serialize_to_string
())
else
:
desc
.
_set_attr
(
name
,
val
)
@
property
@
property
def
inputs
(
self
):
def
inputs
(
self
):
"""
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录