Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
871d6524
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
871d6524
编写于
6月 12, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
!1999 Fix python test case of UT probability failure.
Merge pull request !1999 from rick_sanchez/huangyong
上级
3085e51e
ea5fa783
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
12 deletion
+29
-12
mindspore/ccsrc/pipeline/pipeline.cc
mindspore/ccsrc/pipeline/pipeline.cc
+1
-1
mindspore/ccsrc/pynative/pynative_execute.cc
mindspore/ccsrc/pynative/pynative_execute.cc
+23
-8
mindspore/ccsrc/pynative/pynative_execute.h
mindspore/ccsrc/pynative/pynative_execute.h
+2
-1
mindspore/common/api.py
mindspore/common/api.py
+2
-2
mindspore/nn/cell.py
mindspore/nn/cell.py
+1
-0
未找到文件。
mindspore/ccsrc/pipeline/pipeline.cc
浏览文件 @
871d6524
...
...
@@ -882,7 +882,7 @@ void ClearResAtexit() {
pipeline
::
GetMethodMap
().
clear
();
pipeline
::
ExecutorPy
::
ClearRes
();
pipeline
::
ReclaimOptimizer
();
pynative
::
PynativeExecutor
::
GetInstance
()
->
Clea
n
();
pynative
::
PynativeExecutor
::
GetInstance
()
->
Clea
rRes
();
#ifdef ENABLE_GE
transform
::
DfGraphManager
::
GetInstance
().
ClearGraph
();
transform
::
DfGraphConvertor
::
get_adpt_map
().
clear
();
...
...
mindspore/ccsrc/pynative/pynative_execute.cc
浏览文件 @
871d6524
...
...
@@ -595,7 +595,7 @@ py::tuple RunOp(const py::args &args) {
void
ClearPyNativeSession
()
{
session
=
nullptr
;
}
PynativeExecutor
::~
PynativeExecutor
()
{
Clea
n
();
}
PynativeExecutor
::~
PynativeExecutor
()
{
Clea
rRes
();
}
PynativeExecutor
::
PynativeExecutor
()
{
grad_flag_
=
false
;
}
...
...
@@ -849,17 +849,32 @@ void PynativeExecutor::GradNet(const GradOperationPtr &grad, const py::object &c
pipeline
::
ReclaimOptimizer
();
}
void
PynativeExecutor
::
Clear
()
{
MS_LOG
(
INFO
)
<<
"Clear all res"
;
top_g_
=
curr_g_
=
nullptr
;
std
::
stack
<
FuncGraphPtr
>
().
swap
(
graph_p_
);
void
PynativeExecutor
::
Clear
(
const
std
::
string
&
flag
)
{
if
(
flag
==
"resource"
)
{
MS_LOG
(
INFO
)
<<
"Clear res"
;
Clean
();
return
;
}
MS_LOG
(
INFO
)
<<
"Clear"
;
top_g_
=
nullptr
;
curr_g_
=
nullptr
;
graph_info_map_
.
clear
();
std
::
stack
<
FuncGraphPtr
>
().
swap
(
graph_p_
);
}
void
PynativeExecutor
::
Clean
()
{
MS_LOG
(
INFO
)
<<
"Clean all res"
;
Clear
();
grad_flag_
=
false
;
graph_map_
.
clear
();
cell_graph_map_
.
clear
();
Clear
();
df_builder_
=
nullptr
;
ad
::
CleanRes
();
pipeline
::
ReclaimOptimizer
();
}
void
PynativeExecutor
::
ClearRes
()
{
Clean
();
resource_
.
reset
();
}
...
...
@@ -908,8 +923,8 @@ REGISTER_PYBIND_DEFINE(PynativeExecutor_, ([](const py::module *m) {
.
def_static
(
"get_instance"
,
&
PynativeExecutor
::
GetInstance
,
"PynativeExecutor get_instance."
)
.
def
(
"new_graph"
,
&
PynativeExecutor
::
NewGraph
,
"pynative new a graph."
)
.
def
(
"end_graph"
,
&
PynativeExecutor
::
EndGraph
,
"pynative end a graph."
)
.
def
(
"grad_net"
,
&
PynativeExecutor
::
GradNet
,
"pynative
grad graph."
)
.
def
(
"clear"
,
&
PynativeExecutor
::
Clear
,
"pynative
clear status."
)
.
def
(
"grad_net"
,
&
PynativeExecutor
::
GradNet
,
"pynative grad graph."
)
.
def
(
"clear"
,
&
PynativeExecutor
::
Clear
,
"pynative clear status."
)
.
def
(
"__call__"
,
&
PynativeExecutor
::
Run
,
py
::
arg
(
"args"
),
py
::
arg
(
"phase"
)
=
py
::
str
(
""
),
"Executor run function."
)
.
def
(
"set_grad_flag"
,
&
PynativeExecutor
::
set_grad_flag
,
py
::
arg
(
"flag"
)
=
py
::
bool_
(
false
),
...
...
mindspore/ccsrc/pynative/pynative_execute.h
浏览文件 @
871d6524
...
...
@@ -68,8 +68,9 @@ class PynativeExecutor : public std::enable_shared_from_this<PynativeExecutor> {
void
NewGraph
(
const
py
::
object
&
cell
,
const
py
::
args
&
args
);
void
EndGraph
(
const
py
::
object
&
cell
,
const
py
::
object
&
out
,
const
py
::
args
&
args
);
void
GradNet
(
const
GradOperationPtr
&
grad
,
const
py
::
object
&
cell
,
const
py
::
object
&
weights
,
const
py
::
args
&
args
);
void
Clear
();
void
Clear
(
const
std
::
string
&
flag
=
""
);
void
Clean
();
void
ClearRes
();
bool
grad_flag
()
{
return
grad_flag_
;
}
void
set_grad_flag
(
bool
flag
)
{
grad_flag_
=
flag
;
}
AnfNodePtr
GetInput
(
const
py
::
object
&
obj
,
const
py
::
object
&
op_mask
);
...
...
mindspore/common/api.py
浏览文件 @
871d6524
...
...
@@ -293,8 +293,8 @@ class _PynativeExecutor:
def
grad
(
self
,
grad
,
obj
,
weights
,
*
args
):
self
.
_executor
.
grad_net
(
grad
,
obj
,
weights
,
*
args
)
def
clear
(
self
):
self
.
_executor
.
clear
()
def
clear
(
self
,
flag
=
""
):
self
.
_executor
.
clear
(
flag
)
def
set_grad_flag
(
self
,
flag
):
self
.
_executor
.
set_grad_flag
(
flag
)
...
...
mindspore/nn/cell.py
浏览文件 @
871d6524
...
...
@@ -186,6 +186,7 @@ class Cell:
raise
AttributeError
(
"'{}' object has no attribute '{}'."
.
format
(
type
(
self
).
__name__
,
name
))
def
__del__
(
self
):
_pynative_exec
.
clear
(
"resource"
)
if
hasattr
(
self
,
"_create_time"
):
_executor
.
del_net_res
(
str
(
self
.
_create_time
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录