Optimize performance of PyNative first step

pull/8700/head
caifubi 4 years ago
parent 7224880b72
commit a480f064c4

@ -354,11 +354,11 @@ void KernelGraph::CheckLoop() {
if (node_input_it == node_input_edges_.end()) { if (node_input_it == node_input_edges_.end()) {
MS_LOG(EXCEPTION) << "Can't find node [" << it.first->DebugString() << "]"; 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) { 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; MS_LOG(WARNING) << "Node:" << it.first->DebugString() << ",inputs:" << str << ",input num:" << it.second;
none_zero_nodes[it.first] = it.second; none_zero_nodes[it.first] = it.second;
} }

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

Loading…
Cancel
Save