!8700 Optimize performance of PyNative

From: @jojobugfree
Reviewed-by: @kisnwang,@chujinjin
Signed-off-by: @chujinjin
This commit is contained in:
mindspore-ci-bot 2020-11-18 09:41:01 +08:00 committed by Gitee
commit 9d260cbf56
2 changed files with 9 additions and 9 deletions

View File

@ -354,11 +354,11 @@ void KernelGraph::CheckLoop() {
if (node_input_it == node_input_edges_.end()) {
MS_LOG(EXCEPTION) << "Can't find node [" << it.first->DebugString() << "]";
}
for (const auto &input_edge : node_input_edges_[it.first]) {
MS_EXCEPTION_IF_NULL(input_edge.first);
str = str.append(input_edge.first->DebugString()).append("|");
}
if (it.second != 0) {
for (const auto &input_edge : node_input_edges_[it.first]) {
MS_EXCEPTION_IF_NULL(input_edge.first);
str = str.append(input_edge.first->DebugString()).append("|");
}
MS_LOG(WARNING) << "Node:" << it.first->DebugString() << ",inputs:" << str << ",input num:" << it.second;
none_zero_nodes[it.first] = it.second;
}

View File

@ -172,9 +172,9 @@ void UpdateCurMatchCounts(const kernel::KernelBuildInfo &kernel_build_info, cons
}
}
void PrintRaiseOrReducePrecisionSelectedInfo(const CNodePtr &cnode,
const std::shared_ptr<kernel::KernelBuildInfo> &selected_kernel_build_info,
bool precision_reduce) {
std::string PrintRaiseOrReducePrecisionSelectedInfo(
const CNodePtr &cnode, const std::shared_ptr<kernel::KernelBuildInfo> &selected_kernel_build_info,
bool precision_reduce) {
MS_EXCEPTION_IF_NULL(selected_kernel_build_info);
MS_EXCEPTION_IF_NULL(cnode);
std::ostringstream buffer;
@ -186,7 +186,7 @@ void PrintRaiseOrReducePrecisionSelectedInfo(const CNodePtr &cnode,
}
PrintInputAndOutputInferType(buffer, cnode);
buffer << ", select kernel:" << selected_kernel_build_info->ToString();
MS_LOG(INFO) << buffer.str();
return buffer.str();
}
std::shared_ptr<kernel::KernelBuildInfo> ChooseMatchedKernelInfo(
@ -381,7 +381,7 @@ KernelSelectStatus SetMatchedKernelInfo(const CNodePtr &kernel_node,
if (selected_kernel_info == nullptr) {
return select_status;
} else {
PrintRaiseOrReducePrecisionSelectedInfo(kernel_node, selected_kernel_info, precision_reduce);
MS_LOG(INFO) << PrintRaiseOrReducePrecisionSelectedInfo(kernel_node, selected_kernel_info, precision_reduce);
select_status = precision_reduce ? kStatusReducePrecision : kStatusRaisePrecision;
}
}