!37203 fix pipeline.cc log

Merge pull request !37203 from huanghui/fix-log
This commit is contained in:
i-robot 2022-07-06 06:56:27 +00:00 committed by Gitee
commit 2980e73b2d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 18 additions and 7 deletions

View File

@ -319,11 +319,10 @@ bool AnalyzeFailExporter::ExportFuncGraph(const std::string &filename, const Tra
MS_LOG(ERROR) << "Open file '" << real_filepath.value() << "' failed!" << ErrnoToString(errno);
return false;
}
ofs << "#===============================================================================\n";
ofs << "#1.This file shows the parsed IR info when graph evaluating failed to help find the problem.\n";
ofs << "#2.You can search the last `------------------------>` to the node which is inferred failed.\n";
ofs << "#3.Refer to https://www.mindspore.cn/search?inputValue=analyze_fail.dat to get more instructions.\n";
ofs << "#===============================================================================\n\n";
ofs << "# 1.This file shows the parsed IR info when graph evaluating failed to help find the problem.\n";
ofs << "# 2.You can search the last `------------------------>` to the node which is inferred failed.\n";
ofs << "# 3.Refer to https://www.mindspore.cn/search?inputValue=analyze_fail.dat to get more instructions.\n";
ofs << "# ===============================================================================\n\n";
if (engine_ == nullptr) {
engine_ = node_config_stack.front()->engine();

View File

@ -250,6 +250,18 @@ void SetValueMutable(const abstract::AbstractBasePtr &abs) {
abs->set_value_mutable(true);
}
std::string ToOrdinal(const size_t &i) {
auto suffix = "th";
if (i == kIndex1) {
suffix = "st";
} else if (i == kIndex2) {
suffix = "nd";
} else if (i == kIndex3) {
suffix = "rd";
}
return std::to_string(i) + suffix;
}
} // namespace
void CheckArgsValid(const py::object &source_obj, const py::tuple &args) {
@ -276,7 +288,7 @@ void CheckArgsValid(const py::object &source_obj, const py::tuple &args) {
<< " support bool, int, float, None, Tensor, Parameter, "
"mstype.Number(mstype.bool, mstype.int, mstype.float, mstype.uint), "
"and tuple or list containing only these types, and dict whose values are these types, but the "
<< i << "th arg type is " << args[i].get_type() << ", value is '" << py::str(args[i]) << "'.\n"
<< ToOrdinal(i + 1) << " arg type is " << args[i].get_type() << ", value is '" << py::str(args[i]) << "'.\n"
<< "For more details, please search 'outermost network' at https://www.mindspore.cn.";
}
}

View File

@ -111,7 +111,7 @@ def test_net_inputs_including_str(mode):
assert "support bool, int, float, None, Tensor, " \
"Parameter, mstype.Number(mstype.bool, mstype.int, mstype.float, mstype.uint), " \
"and tuple or list containing only these types, and dict whose values are these types, " \
"but the 1th arg type is <class 'str'>, value is 'ok'" in str(err.value)
"but the 2nd arg type is <class 'str'>, value is 'ok'" in str(err.value)
# Support the Parameter as outermost input.