2.4K Star 8.2K Fork 4.4K

GVPMindSpore / mindspore

 / 详情

[CT][MS]cell list append, does not update parameter name

ACCEPTED
RFC 成员
创建于  
2022-11-04 12:39
name about labels
Bug Report Use this template for reporting a bug kind/bug

Describe the current behavior / 问题描述 (Mandatory / 必填)

同一个Cell里,有多个Celllist的场景,参数名会有重复报错

Environment / 环境信息 (Mandatory / 必填)

  • Hardware Environment(Ascend/GPU/CPU) / 硬件环境:

Please delete the backend not involved / 请删除不涉及的后端:
/device ascend/GPU/CPU

  • Software Environment / 软件环境 (Mandatory / 必填):
    -- MindSpore version (e.g., 1.7.0.Bxxx) :0d0e70a4
    -- Python version (e.g., Python 3.7.5) :
    -- OS platform and distribution (e.g., Linux Ubuntu 16.04):
    -- GCC/Compiler version (if compiled from source):

  • Excute Mode / 执行模式 (Mandatory / 必填)(PyNative/Graph):

Please delete the mode not involved / 请删除不涉及的模式:

/mode graph

Related testcase / 关联用例 (Mandatory / 必填)

import mindspore as ms
from mindspore import ops, nn
ms.set_context(mode=ms.GRAPH_MODE)

class Net(nn.Cell):
    def __init__(self):
        super().__init__()
        self.cell_list1 = nn.CellList()
        self.cell_list2 = nn.CellList()
        for i in range(5):
            m1 = nn.Dense(2, 2)
            m2 = nn.Dense(2, 2)
            self.cell_list1.append(m1)
            self.cell_list2.append(m2)
    
    def construct(self, x1, x2):
        for i in range(5):
           x2 = self.cell_list1[i](x1)
           x1 = self.cell_list2[i](x2)
        return x1 + x2

x1 = ops.ones((2, 2), ms.float32)
x2 = ops.ones((2, 2), ms.float32)
net = Net()
y = net(x1, x2)
print(y)

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

  1. python

Describe the expected behavior / 预期结果 (Mandatory / 必填)

pass

Related log / screenshot / 日志 / 截图 (Mandatory / 必填)

Traceback (most recent call last):
File "utils.py", line 32, in
y = net(x1, x2)
File "D:\conda\anaconda\lib\site-packages\mindspore\nn\cell.py", line 596, in call
out = self.compile_and_run(*args)
File "D:\conda\anaconda\lib\site-packages\mindspore\nn\cell.py", line 985, in compile_and_run
self.compile(*inputs)
File "D:\conda\anaconda\lib\site-packages\mindspore\nn\cell.py", line 957, in compile
jit_config_dict=self._jit_config_dict)
File "D:\conda\anaconda\lib\site-packages\mindspore\common\api.py", line 1122, in compile
obj.check_names()
File "D:\conda\anaconda\lib\site-packages\mindspore\nn\cell.py", line 1308, in check_names
"Please set a unique name for the parameter.".format(value, param, param.name))
ValueError: The value of cell_list2.0.weight is Parameter (name=0.weight, shape=(2, 2), dtype=Float32, requires_grad=True), its name '0.weight' already exists. Please set a unique name for the parameter.

Special notes for this issue/备注 (Optional / 选填)

评论 (4)

chentanjie 创建了Bug-Report
chentanjie 添加了
 
kind/bug
标签
chentanjie 添加了
 
sig/frontend
标签
chentanjie 添加了
 
v2.0.0.rc1
标签
展开全部操作日志

Please assign maintainer to check this issue.
请为此issue分配处理人。
@chentanjie

Please add labels (comp or sig), also you can visit https://gitee.com/mindspore/community/blob/master/sigs/dx/docs/labels.md to find more.
为了让代码尽快被审核,请您为Pull Request打上 组件(comp)或兴趣组(sig) 标签,打上标签的PR可直接推送给责任人进行审核。
更多的标签可以查看https://gitee.com/mindspore/community/blob/master/sigs/dx/docs/labels.md
以组件相关代码提交为例,如果你提交的是data组件代码,你可以这样评论:
//comp/data
当然你也可以邀请data SIG组来审核代码,可以这样写:
//sig/data
另外你还可以给这个PR标记类型,例如是bugfix或者是特性需求:
//kind/bug or //kind/feature
恭喜你,你已经学会了使用命令来打标签,接下来就在下面的评论里打上标签吧!

chentanjie 关联分支设置为master

框架机制问题,待梳理后重构

changzherui 任务状态TODO 修改为ACCEPTED
changzherui 添加了
 
rct/newfeature
标签
changzherui 添加了
 
ccb/rfc
标签
changzherui 任务类型Bug-Report 修改为RFC
changzherui 添加协作者changzherui
changzherui 负责人changzherui 修改为冯一航

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(3)
7347217 changzherui 1584948547 5280992 chen tanjie 1645579326
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore

搜索帮助