forked from huawei/mindspore2022
fix_warning_of_codes
This commit is contained in:
parent
2ae65ae387
commit
ab32ebc758
|
|
@ -303,7 +303,6 @@ struct GlogLogDirRegister {
|
|||
std::string log_dir_str = std::string(log_dir);
|
||||
|
||||
auto real_log_dir_str = Common::GetRealPath(log_dir_str);
|
||||
|
||||
// While 'GLOG_logtostderr' = 0, logs output to files.
|
||||
// 'GLOG_log_dir' must be specified as the path of log files.
|
||||
if (logtostderr_str == "0" && real_log_dir_str.has_value()) {
|
||||
|
|
|
|||
|
|
@ -140,5 +140,4 @@ std::string GetOpNameWithoutScope(const std::string &fullname_with_scope) {
|
|||
}
|
||||
return op_name;
|
||||
}
|
||||
|
||||
} // namespace mindspore
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ void Debugger::PreExecute(const KernelGraphPtr &graph_ptr) {
|
|||
debug_services_->ResetLoadedTensors();
|
||||
}
|
||||
// resets for the new graph
|
||||
suspended_at_last_kernel_ = 0;
|
||||
suspended_at_last_kernel_ = false;
|
||||
}
|
||||
bool Debugger::DumpDataEnabledIteration() const {
|
||||
auto &dump_json_parser = DumpJsonParser::GetInstance();
|
||||
|
|
@ -370,7 +370,7 @@ void Debugger::Dump(const KernelGraphPtr &kernel_graph) const {
|
|||
uint32_t rank_id = GetRankID();
|
||||
if (debugger_->DebuggerBackendEnabled()) {
|
||||
MS_EXCEPTION_IF_NULL(kernel_graph);
|
||||
E2eDump::DumpParametersAndConstData(kernel_graph.get(), rank_id, debugger_.get());
|
||||
(void)E2eDump::DumpParametersAndConstData(kernel_graph.get(), rank_id, debugger_.get());
|
||||
} else {
|
||||
DumpJsonParser::GetInstance().UpdateDumpIter();
|
||||
}
|
||||
|
|
@ -379,7 +379,7 @@ void Debugger::Dump(const KernelGraphPtr &kernel_graph) const {
|
|||
void Debugger::DumpSingleNode(const CNodePtr &node, uint32_t graph_id) {
|
||||
if (debugger_->DebuggerBackendEnabled()) {
|
||||
uint32_t rank_id = GetRankID();
|
||||
E2eDump::DumpSingleNodeData(node, graph_id, rank_id, debugger_.get());
|
||||
(void)E2eDump::DumpSingleNodeData(node, graph_id, rank_id, debugger_.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -497,7 +497,7 @@ void Debugger::PostExecuteNode(const CNodePtr &kernel, bool last_kernel) {
|
|||
// if kernel is not watchpoint and is next_to or continue_to node, suspend
|
||||
// sets a bool to be checked in preExecute to avoid double stopping at last kernel in the last graph
|
||||
if (last_kernel) {
|
||||
suspended_at_last_kernel_ = 1;
|
||||
suspended_at_last_kernel_ = true;
|
||||
}
|
||||
CommandLoop();
|
||||
}
|
||||
|
|
@ -1147,7 +1147,7 @@ std::vector<std::string> Debugger::CheckOpOverflow() {
|
|||
if (dir->d_type == DT_REG) {
|
||||
std::string file_path = overflow_bin_path;
|
||||
std::string file_name = dir->d_name;
|
||||
file_path.append(file_name);
|
||||
(void)file_path.append(file_name);
|
||||
std::fstream infile;
|
||||
infile.open(file_path.c_str(), std::ios::binary | std::ios::in);
|
||||
if (!infile.is_open()) {
|
||||
|
|
|
|||
|
|
@ -173,9 +173,6 @@ std::vector<watchpoint_hit_t> DbgServices::CheckWatchpoints(unsigned int iterati
|
|||
std::vector<int32_t> error_codes;
|
||||
std::vector<unsigned int> rank_id;
|
||||
std::vector<unsigned int> root_graph_id;
|
||||
// #ifdef ENABLE_D
|
||||
// overflow_ops = CheckOpOverflow();
|
||||
// #endif
|
||||
|
||||
std::vector<std::shared_ptr<TensorData>> tensor_list;
|
||||
std::vector<std::string> file_paths;
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ bool AnalyzeFailExporter::ExportFuncGraph(const std::string &filename,
|
|||
if (printed_func_graphs.find(fg) != printed_func_graphs.end()) {
|
||||
continue;
|
||||
}
|
||||
printed_func_graphs.emplace(fg);
|
||||
(void)printed_func_graphs.emplace(fg);
|
||||
|
||||
current_context_ = node_config->context(); // Set current context.
|
||||
ExportOneFuncGraph(ofs, fg, tagged_func_graphs[fg]);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ AnfNodePtr Map::FullMakeList(const std::shared_ptr<List> &type, const FuncGraphP
|
|||
|
||||
auto call_node = func_graph->NewCNodeInOrder(inputs2);
|
||||
if (reverse_) {
|
||||
inputs.insert(inputs.begin() + 1, call_node);
|
||||
(void)inputs.insert(inputs.begin() + 1, call_node);
|
||||
} else {
|
||||
inputs.emplace_back(call_node);
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ AnfNodePtr Map::FullMakeTuple(const std::shared_ptr<Tuple> &type, const FuncGrap
|
|||
|
||||
auto call_node = func_graph->NewCNodeInOrder(inputs2);
|
||||
if (reverse_) {
|
||||
inputs.insert(inputs.begin() + 1, call_node);
|
||||
(void)inputs.insert(inputs.begin() + 1, call_node);
|
||||
} else {
|
||||
inputs.emplace_back(call_node);
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ AnfNodePtr Map::FullMakeClass(const std::shared_ptr<Class> &type, const FuncGrap
|
|||
|
||||
auto call_node = func_graph->NewCNodeInOrder(inputs2);
|
||||
if (reverse_) {
|
||||
inputs.insert(inputs.begin() + 2, call_node);
|
||||
(void)inputs.insert(inputs.begin() + 2, call_node);
|
||||
} else {
|
||||
inputs.emplace_back(call_node);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ bool IsSerializableBprop(const PrimitivePtr &prim) {
|
|||
[&prim](const PrimitivePtr &serializable_bprop_prim) {
|
||||
auto str1 = prim->name();
|
||||
auto str2 = serializable_bprop_prim->name();
|
||||
transform(str1.begin(), str1.end(), str1.begin(), ::tolower);
|
||||
transform(str2.begin(), str2.end(), str2.begin(), ::tolower);
|
||||
(void)transform(str1.begin(), str1.end(), str1.begin(), ::tolower);
|
||||
(void)transform(str2.begin(), str2.end(), str2.begin(), ::tolower);
|
||||
return str1 == str2;
|
||||
});
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ FuncGraphPtr KPrim::GetBprop(const PrimitivePtr &prim, const pipeline::ResourceB
|
|||
func_graph->set_flag(mindspore::kFuncGraphFlagReAutoMonad, true);
|
||||
}
|
||||
pipeline::ResourceBasePtr res = (resources != nullptr) ? resources : std::make_shared<pipeline::Resource>();
|
||||
parse::ResolveFuncGraph(func_graph, res);
|
||||
(void)parse::ResolveFuncGraph(func_graph, res);
|
||||
#ifndef _WIN32
|
||||
// Check whether the bprop needs to be exported.
|
||||
if (serializable) {
|
||||
|
|
@ -312,7 +312,7 @@ FuncGraphPtr KPrim::KPrimitive(const CNodePtr &cnode, const ValueNodePtr &value_
|
|||
if (resources != nullptr) {
|
||||
auto manager = resources->manager();
|
||||
auto &users = manager->node_users()[value_node];
|
||||
for (auto user_iter = users.begin(); user_iter != users.end(); user_iter++) {
|
||||
for (auto user_iter = users.begin(); user_iter != users.end(); ++user_iter) {
|
||||
primal_debug_infos.push_back(user_iter->first->debug_info());
|
||||
}
|
||||
}
|
||||
|
|
@ -493,8 +493,8 @@ void KPrim::CheckBprop(const FuncGraphPtr &bprop_fg, const string &prim_to_check
|
|||
inputs.emplace_back(NewValueNode(prim::kPrimMakeTuple));
|
||||
constexpr int primitive_size = 1;
|
||||
constexpr int brprop_offset_size = 2;
|
||||
inputs.insert(inputs.begin() + primitive_size, bprop_fg->parameters().begin(),
|
||||
bprop_fg->parameters().end() - brprop_offset_size);
|
||||
(void)inputs.insert(inputs.begin() + primitive_size, bprop_fg->parameters().begin(),
|
||||
bprop_fg->parameters().end() - brprop_offset_size);
|
||||
AnfNodePtr params = bprop_fg->NewCNode(inputs);
|
||||
|
||||
inputs.clear();
|
||||
|
|
|
|||
|
|
@ -234,9 +234,7 @@ class OrderEnforcer {
|
|||
|
||||
} // namespace
|
||||
|
||||
//
|
||||
// Enforce order of execution for Load users node.
|
||||
//
|
||||
void OrderEnforce(const FuncGraphPtr &func_graph) {
|
||||
OrderEnforcer enforcer(func_graph);
|
||||
enforcer.Run();
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ PrimitivePy::PrimitivePy(const py::object &python_obj, const PrimitivePyAdapterP
|
|||
: Primitive(adapter->name_, false), python_obj_(python_obj), adapter_(adapter) {
|
||||
MS_LOG(DEBUG) << "New primitive:" << adapter->name_;
|
||||
set_signatures(adapter->signatures_);
|
||||
Primitive::SetAttrs(adapter->attrs_);
|
||||
(void)Primitive::SetAttrs(adapter->attrs_);
|
||||
Primitive::set_prim_type(adapter->prim_type_);
|
||||
Primitive::set_const_prim(adapter->is_const_prim_);
|
||||
Primitive::set_const_input_indexes(adapter->const_input_indexes_);
|
||||
|
|
@ -305,7 +305,7 @@ void PrimitivePy::CopyHookFunction(const PrimitivePtr &primitive) {
|
|||
MS_EXCEPTION_IF_NULL(primitive_py);
|
||||
this->set_hook(primitive_py->hook());
|
||||
if (primitive_py->HasAttr(kBpropAttrName)) {
|
||||
this->AddAttr(kBpropAttrName, primitive_py->GetAttr(kBpropAttrName));
|
||||
(void)this->AddAttr(kBpropAttrName, primitive_py->GetAttr(kBpropAttrName));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -392,11 +392,11 @@ void PrimitivePyAdapter::AddPyAttr(const py::str &name, const py::object &obj) {
|
|||
if (kOpAttrNameReplaceMap.find(attr_name) != kOpAttrNameReplaceMap.end()) {
|
||||
attr_name = kOpAttrNameReplaceMap[attr_name];
|
||||
}
|
||||
CheckAndConvertUtils::ConvertAttrValueToInt(name_, name, &converted_ret);
|
||||
(void)CheckAndConvertUtils::ConvertAttrValueToInt(name_, name, &converted_ret);
|
||||
attrs_[attr_name] = converted_ret;
|
||||
auto prim = attached_primitive_.lock();
|
||||
if (prim != nullptr) {
|
||||
prim->AddAttr(attr_name, converted_ret);
|
||||
(void)prim->AddAttr(attr_name, converted_ret);
|
||||
}
|
||||
|
||||
if (attr_name == "primitive_target") {
|
||||
|
|
@ -415,10 +415,10 @@ void PrimitivePyAdapter::AddPyAttr(const py::str &name, const py::object &obj) {
|
|||
}
|
||||
|
||||
void PrimitivePyAdapter::DelPyAttr(const py::str &name) {
|
||||
attrs_.erase(name);
|
||||
(void)attrs_.erase(name);
|
||||
auto prim = attached_primitive_.lock();
|
||||
if (prim != nullptr) {
|
||||
prim->DelAttr(name);
|
||||
(void)prim->DelAttr(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace mindspore {
|
||||
namespace {
|
||||
void MsCtxSetParameter(std::shared_ptr<MsContext> ctx, MsCtxParam param, const py::object &value) {
|
||||
void MsCtxSetParameter(const std::shared_ptr<MsContext> &ctx, MsCtxParam param, const py::object &value) {
|
||||
MS_LOG(DEBUG) << "set param(" << param << ") with value '" << py::str(value).cast<std::string>() << "' of type '"
|
||||
<< py::str(value.get_type()).cast<std::string>() << "'.";
|
||||
if (param >= MS_CTX_TYPE_BOOL_BEGIN && param < MS_CTX_TYPE_BOOL_END && py::isinstance<py::bool_>(value)) {
|
||||
|
|
|
|||
|
|
@ -46,10 +46,11 @@ std::vector<std::string> GetTokens(const std::string &str, const std::string &de
|
|||
std::pair<std::string, std::string> ParseFlag(const std::string &flag) {
|
||||
auto i = flag.find("--");
|
||||
// check the string starts with "--".
|
||||
if (i != 0 || flag.size() == 2) {
|
||||
constexpr size_t expected_size = 2;
|
||||
if (i != 0 || flag.size() == expected_size) {
|
||||
return std::pair<std::string, std::string>();
|
||||
}
|
||||
i += 2;
|
||||
i += expected_size;
|
||||
|
||||
auto j = flag.find('=', i + 1); // the key should not be empty, "--=" is invalid
|
||||
if (j == std::string::npos) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue