Fix a bug in FunctionImpl::FunctionImpl (#3376)

1. Fix a bug in FunctionImpl::FunctionImpl. It set wrong name for the new attribute.
2. Set error code to NOT_IMPLEMENTED if a function contains a not implemented op.
This commit is contained in:
Changming Sun 2020-03-31 15:54:47 -07:00 committed by GitHub
parent a4fe60c4d3
commit 55fd283d20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -51,7 +51,7 @@ Status KernelRegistryManager::CreateKernel(const onnxruntime::Node& node,
}
}
return Status(ONNXRUNTIME, FAIL, create_error_message("Failed to find kernel for "));
return Status(ONNXRUNTIME, NOT_IMPLEMENTED, create_error_message("Failed to find kernel for "));
}
Status KernelRegistryManager::RegisterKernels(const ExecutionProviders& execution_providers) {
@ -119,7 +119,7 @@ Status KernelRegistryManager::SearchKernelRegistry(const onnxruntime::Node& node
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, NOT_IMPLEMENTED, errormsg.str());
}
} // namespace onnxruntime

View file

@ -366,7 +366,9 @@ FunctionImpl::FunctionImpl(const onnxruntime::Graph& graph,
if (!(*node_attr).ref_attr_name().empty()) {
auto entry = attr_map.find((*node_attr).ref_attr_name());
if (entry != attr_map.cend()) {
new_attr_map[(*node_attr).name()] = entry->second;
onnx::AttributeProto attr_copy = entry->second;
attr_copy.set_name(node_attr->name());
new_attr_map[(*node_attr).name()] = attr_copy;
}
} else {
new_attr_map[(*node_attr).name()] = *node_attr;