name | about | labels |
---|---|---|
Bug Report | Use this template for reporting a bug | kind/bug |
合理的常量控制流场景下抛变量
Ascend
/GPU
/CPU
) / 硬件环境:Please delete the backend not involved / 请删除不涉及的后端:
/device ascend/GPU/CPU/kirin/等其他芯片
Software Environment / 软件环境 (Mandatory / 必填):
ascend_version=
cuda_version=
mindspore_commit=commit_id = '[sha1]:3eb447b7,[branch]:(HEAD,origin/master,origin/HEAD,master)'
mindsporetest_commit=704467082efe102a1a838f6d55a873bf16c8376a
CONTEXT_DEVICE_TARGET=CPU
CONTEXT_MODE=GRAPH_MODE
Excute Mode / 执行模式 (Mandatory / 必填)(PyNative
/Graph
):
Please delete the mode not involved / 请删除不涉及的模式:
/mode graph
def test_parser_fallback_raise_else():
class RaiseNet(nn.Cell):
def construct(self, x, z):
if z >= 1:
raise ValueError(f"The input can be {x}")
else:
return x + 1
x = mutable(1)
net = RaiseNet()
with pytest.raises(ValueError) as e:
net(x, 1)
assert "The input can be 1" in str(e.value)
assert net(x, 0) == 2
用例正常执行
E RuntimeError: Should not raise with variable under a constant condition.
E
E In file /home/jenkins-slave/workspace/mindspore_cpu_feature_opensource/MindSporeTest/parse/test_parser_fallback_sequence.py:504
E raise ValueError(f"The input can be {x}")
E ^
E
E ----------------------------------------------------
E - The Traceback of Net Construct Code:
E ----------------------------------------------------
E The function call stack (See file '/home/jenkins-slave/workspace/mindspore_cpu_feature_opensource/MindSporeTest/parse/rank_0/om/analyze_fail.ir' for more details. Get instructions about `analyze_fail.ir` at https://www.mindspore.cn/search?inputValue=analyze_fail.ir):
E # 0 In file /home/jenkins-slave/workspace/mindspore_cpu_feature_opensource/MindSporeTest/parse/test_parser_fallback_sequence.py:503
E if z >= 1:
E # 1 In file /home/jenkins-slave/workspace/mindspore_cpu_feature_opensource/MindSporeTest/parse/test_parser_fallback_sequence.py:504
E raise ValueError(f"The input can be {x}")
E ^
E
E ----------------------------------------------------
E - C++ Call Stack: (For framework developers)
E ----------------------------------------------------
E mindspore/ccsrc/pipeline/jit/static_analysis/prim.cc:2989 EvalPrim
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
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
恭喜你,你已经学会了使用命令来打标签,接下来就在下面的评论里打上标签吧!
Appearance & Root Cause
问题:常量控制流下抛出变量抛出异常
原因:过去认为该场景为异常场景,所以加了报错看护
Fix Solution
解决方法:删除该看护报错。
关联PR:!54534:放开raise常量控制流下抛出变量限制,并解决检查控制流core dump问题
登录 后才可以发表评论