Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
6710e1fe
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看板
提交
6710e1fe
编写于
5月 12, 2020
作者:
C
chenzomi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add param_perfix to cell
上级
3d3b9d54
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
2 deletion
+19
-2
mindspore/nn/cell.py
mindspore/nn/cell.py
+19
-2
未找到文件。
mindspore/nn/cell.py
浏览文件 @
6710e1fe
...
...
@@ -61,6 +61,7 @@ class Cell:
self
.
_cells
=
OrderedDict
()
self
.
training
=
False
self
.
pynative
=
False
self
.
_param_perfix
=
''
self
.
_auto_prefix
=
auto_prefix
self
.
_scope
=
None
self
.
_phase
=
'train'
...
...
@@ -85,6 +86,24 @@ class Cell:
def
cell_init_args
(
self
):
return
self
.
_cell_init_args
@
property
def
param_perfix
(
self
):
"""
Param perfix is the prfix of curent cell's direct child parameter.
"""
return
self
.
_param_perfix
def
update_cell_prefix
(
self
):
"""
Update the all child cells' self.param_prefix.
After invoked, can get all the cell's children's name perfix by '_param_perfix'.
"""
cells
=
self
.
cells_and_names
for
cell_name
,
cell
in
cells
:
cell
.
_param_perfix
=
cell_name
@
cell_init_args
.
setter
def
cell_init_args
(
self
,
value
):
if
not
isinstance
(
value
,
str
):
...
...
@@ -225,7 +244,6 @@ class Cell:
Args:
params (dict): The parameters dictionary used for init data graph.
"""
if
params
is
None
:
for
key
in
self
.
parameters_dict
():
tensor
=
self
.
parameters_dict
()[
key
].
data
...
...
@@ -255,7 +273,6 @@ class Cell:
Args:
inputs (Function or Cell): inputs of construct method.
"""
parallel_inputs_run
=
[]
if
len
(
inputs
)
>
self
.
_construct_inputs_num
:
raise
ValueError
(
'Len of inputs: {} is bigger than self._construct_inputs_num: {}.'
.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录