diff --git a/mindspore/_extends/parse/standard_method.py b/mindspore/_extends/parse/standard_method.py index dbfd625f8d..d9ad392f87 100644 --- a/mindspore/_extends/parse/standard_method.py +++ b/mindspore/_extends/parse/standard_method.py @@ -132,7 +132,9 @@ def while_cond(x): @constexpr def check_type_same(x_type, base_type): """Check x_type is same as base_type.""" - return mstype.issubclass_(x_type, base_type) + if mstype.issubclass_(x_type, base_type): + return True + raise TypeError(f"The arg 'x' should be a {base_type}, but got {x_type}.") @constexpr diff --git a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc index 98b9e5b62d..bad48d0ca4 100644 --- a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc @@ -915,8 +915,8 @@ void PynativeExecutor::EndGraphInner(const py::object &cell, const py::object &o cnode->set_inputs(args); set_obj_node_map(curr_g_, out_id, cnode); } else { - MS_LOG(ERROR) << "Graph has no this out: " << out_id; - return; + MS_LOG(DEBUG) << "Set ValueNode as output for graph, out id: " << out_id; + MakeValueNode(out, out_id); } } EndGraphByOutId(out_id, cell, out, args); diff --git a/mindspore/ops/operations/array_ops.py b/mindspore/ops/operations/array_ops.py index 18b38f543b..18259da9a9 100644 --- a/mindspore/ops/operations/array_ops.py +++ b/mindspore/ops/operations/array_ops.py @@ -1957,7 +1957,7 @@ def _compute_slicing_length(begin, end, stride, x_shape, i): if begin >= x_dim: # When slicing backward, if begin >= x_dim, set begin = -1, which means start from the last element. begin = -1 - if 0 < end < x_dim: + if 0 <= end < x_dim: end += -x_dim if end < -x_dim - 1: # When slicing backward, if end < -x_dim - 1, set end = -x_dim - 1, which means