fix error for graph

This commit is contained in:
lianliguang 2023-08-14 17:31:59 +08:00
parent fe713dd880
commit 6650618d92
4 changed files with 22 additions and 2 deletions

View File

@ -208,6 +208,7 @@
"mindspore/tests/st/ops/dynamic_shape/" "relative-beyond-top-level"
"mindspore/tests/st/ops/dynamic_shape/" "too-many-arguments"
"mindspore/tests/st/ops/dynamic_shape/" "too-many-locals"
"mindspore/tests/ut/python/graph_syntax/test_invalid_attribute.py" "misplaced-bare-raise"
#MindSpore Lite
"mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/generator.py" "redefined-builtin"

View File

@ -995,7 +995,7 @@ bool AddEmbeddingCachePass(const ResourcePtr &resource) {
std::vector<PassItem> kVmPasses = {{"py_interpret_to_execute", PyInterpretToExecutePass},
{"rewriter_before_opt_a", RewriterBeforeOptAPass},
{"opt_a", OptPassAGroup},
{"py_interpret_to_execute", PyInterpretToExecutePass},
{"py_interpret_to_execute_after_opt_a", PyInterpretToExecutePass},
{"slice_cell_reuse_recomputed_activation", SliceReuseRecomputedActivationPass},
{"rewriter_after_opt_a", RewriterAfterOptAPass},
{"convert_pyexecute_list_input", ConvertPyExecuteListInputPass},

View File

@ -2997,7 +2997,7 @@ class RaiseEvaluator : public TransitionPrimEvaluator {
MS_EXCEPTION_IF_NULL(cur_graph);
if (args_abs_list.empty()) {
// Process raise.
MS_LOG(INTERNAL_EXCEPTION) << "No active exception to re-raise.";
MS_LOG(INTERNAL_EXCEPTION) << "No active exception to reraise.";
}
const auto &cnode = node->cast<CNodePtr>();
MS_EXCEPTION_IF_NULL(cnode);

View File

@ -145,3 +145,22 @@ def test_create_multitype_funcgraph_instance():
x = Tensor([1])
net = Net()
net(x)
def test_raise_empty():
"""
Feature: test raise error use
Description: raise error use.
Expectation: RuntimeError No active exception to reraise.
"""
class Net(nn.Cell):
def construct(self, x):
if x == 1:
raise
return x
with pytest.raises(RuntimeError) as e:
net = Net()
net(1)
assert "No active exception to reraise" in str(e.value)