diff --git a/mindspore/_checkparam.py b/mindspore/_checkparam.py index 7ec8631dfc..2412ab8e18 100644 --- a/mindspore/_checkparam.py +++ b/mindspore/_checkparam.py @@ -429,8 +429,9 @@ class Validator: @staticmethod def check_file_name_by_regular(target, reg=None, flag=re.ASCII, prim_name=None): + """Check whether file name is legitimate.""" if reg is None: - reg = r"^[0-9a-zA-Z\_\-\.\/\\]*$" + reg = r"^[0-9a-zA-Z\_\-\.\/\\]+$" if re.match(reg, target, flag) is None: prim_name = f'in `{prim_name}`' if prim_name else "" raise ValueError("'{}' {} is illegal, it should be match regular'{}' by flags'{}'".format( diff --git a/mindspore/ccsrc/transform/graph_ir/convert.cc b/mindspore/ccsrc/transform/graph_ir/convert.cc index 47e8b23a9a..ad0c28ed03 100644 --- a/mindspore/ccsrc/transform/graph_ir/convert.cc +++ b/mindspore/ccsrc/transform/graph_ir/convert.cc @@ -596,8 +596,10 @@ void DfGraphConvertor::TraceOutput(const AnfNodePtr node) { // Trace value node if (node->isa()) { auto op = Convert(anf_out); - graph_outputs_.emplace_back(std::make_pair(*op, "")); - AddGraphConstInput(op); + if (op != nullptr) { + graph_outputs_.emplace_back(std::make_pair(*op, "")); + AddGraphConstInput(op); + } return; }