Add details of which node was not able to be placed on an execution provider. (#1665)

This commit is contained in:
Scott McKay 2019-08-21 13:31:00 -07:00 committed by GitHub
parent e652a236b4
commit a68a20e415
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,11 +14,21 @@ Status KernelRegistryManager::CreateKernel(const onnxruntime::Node& node,
const IExecutionProvider& execution_provider,
const SessionState& session_state,
/*out*/ std::unique_ptr<OpKernel>& op_kernel) const {
auto create_error_message = [&node](const std::string& error) {
std::ostringstream errormsg;
errormsg << error << node.OpType();
if (node.Op() != nullptr) errormsg << "(" << node.Op()->since_version() << ")";
if (!node.Name().empty()) errormsg << " (node " << node.Name() << ")";
return errormsg.str();
};
const std::string& ptype = node.GetExecutionProviderType();
if (ptype.empty()) {
return Status(ONNXRUNTIME, FAIL,
"The node is not placed on any Execution Provider, therefore, can't find a suitable kernel for it");
create_error_message("The node is not placed on any Execution Provider, "
"therefore, can't find a suitable kernel for "));
}
Status status;
{
for (auto& registry : custom_kernel_registries_) {
@ -41,11 +51,7 @@ Status KernelRegistryManager::CreateKernel(const onnxruntime::Node& node,
}
}
std::ostringstream errormsg;
errormsg << "Failed to find kernel for " << node.OpType();
if (node.Op() != nullptr) errormsg << "(" << node.Op()->since_version() << ")";
if (!node.Name().empty()) errormsg << " (node " << node.Name() << ")";
return Status(ONNXRUNTIME, FAIL, errormsg.str());
return Status(ONNXRUNTIME, FAIL, create_error_message("Failed to find kernel for "));
}
Status KernelRegistryManager::RegisterKernels(const ExecutionProviders& execution_providers) {