2.3K Star 8K Fork 4.2K

GVPMindSpore / mindspore

 / 详情

[CT][MS][switch_layer] test_parser_switch_layer_contain_diff_conv_same_parameter fail

DONE
Bug-Report
创建于  
2020-10-21 10:44
name about labels
Bug Report Use this template for reporting a bug kind/bug

Environment

  • Hardware Environment(Ascend/GPU/CPU): GPU

  • Software Environment:
    -- MindSpore version (source or binary): vm+graph
    -- 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):

Related testcase

def test_parser_switch_layer_contain_diff_conv_same_parameter():

    class FinalConvNet(Cell, MetaFactory):
        def __init__(self):
            super().__init__()
            MetaFactory.__init__(self)
            self.conv = nn.Conv2d(1, 1, 3, weight_init='ones', pad_mode='pad')
            self.conv2 = nn.Conv2d(1, 1, 3, weight_init='normal', pad_mode='pad')
            self.weight = Parameter(Tensor(np.random.randn(1, 1, 3, 3).astype(np.float32)), name="aaa")
            self.conv.weight = self.weight
            self.conv2.weight = self.weight
            self.funcs = (self.conv, self.conv2)

        def construct(self, i, inputs):
            x = self.funcs[i](inputs)
            return x

    net = FinalConvNet()
    i = Tensor(0, mstype.int32)
    input = Tensor(np.ones([1, 1, 224, 224]).astype(np.float32))
    out = net(i, input)

    out_good = net.conv(input)
    allclose_nparray(out.asnumpy(), out_good.asnumpy(), 0.0001, 0.0001)

    back_net_good = GradOfAllInputsAndParams(net.conv, sens_param=False)
    back_net = GradOfAllInputsAndParams(net, sens_param=False)
    back_out = back_net(i, input)
    back_out_good = back_net_good(input)

    allclose_nparray(back_out[0][1].asnumpy(), back_out_good[0][0].asnumpy(), 0.0001, 0.0001)
    allclose_nparray(back_out[1][0].asnumpy(), back_out_good[1][0].asnumpy(), 0.0001, 0.0001)

Steps to reproduce the issue

Describe the current behavior

输入图片说明

Describe the expected behavior

Related log / screenshot

Special notes for this issue

评论 (1)

echo_hua 创建了Bug-Report
echo_hua 计划截止日期设置为2020-12-31
echo_hua 关联仓库设置为MindSpore/mindspore
echo_hua 负责人设置为chenfei_mindspore
echo_hua 里程碑设置为B-ME
echo_hua 计划开始日期设置为2020-10-21
echo_hua 优先级设置为次要
echo_hua 负责人chenfei_mindspore 修改为zhangqinghua
zhangqinghua 任务状态TODO 修改为WIP
zhangqinghua 任务状态WIP 修改为VALIDATION
zhangqinghua 负责人zhangqinghua 修改为echo_hua
zhangqinghua 里程碑B-ME 修改为B-ComponentTest
展开全部操作日志
echo_hua 任务状态VALIDATION 修改为DONE

登录 后才可以发表评论

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

搜索帮助