forked from huawei/mindspore2022
change the error type from RuntimeError to TypeError
This commit is contained in:
parent
347b0004ae
commit
9319eff958
|
|
@ -357,9 +357,9 @@ AnfNodePtr KPrim::BuildOutput(const FuncGraphPtr &bprop_fg, const FuncGraphPtr &
|
|||
} else if (HasAbstractIOMonad(primal_node)) {
|
||||
extra_node = NewValueNode(kIOMonad);
|
||||
} else {
|
||||
MS_LOG(EXCEPTION) << "Function: " << current_primal_fg->ToString()
|
||||
<< ", has extra parameter which is not UMoand or IOMonad, but: "
|
||||
<< primal_node->DebugString();
|
||||
MS_EXCEPTION(TypeError) << "Function: " << current_primal_fg->ToString()
|
||||
<< ", has extra parameter which is not UMoand or IOMonad, but: "
|
||||
<< primal_node->DebugString();
|
||||
}
|
||||
extra_args.push_back(extra_node);
|
||||
MS_LOG(DEBUG) << "Insert to bprop_fg for node: " << primal_node->DebugString();
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ def test_user_defined_bad_bprop():
|
|||
net = GradNet(user_defined_net)
|
||||
x = Tensor(np.array([2.0], np.float32))
|
||||
y = Tensor(np.array([3.0], np.float32))
|
||||
with pytest.raises(RuntimeError):
|
||||
with pytest.raises(TypeError):
|
||||
net(x, y)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue