set node schema when apply NHWC transformer (#13660)

### Description
set node schema when apply NHWC transformer

### Motivation and Context
The implementation in `IExecutionProvider::GetCapability()` checks node
schema to determine the capability of the current EP. If NHWC graph
transformer created a new channel last `Conv` node to replace the
channel first `Conv` node, we need to assign the schema to the replaced
node.
This commit is contained in:
Yulong Wang 2022-11-22 12:26:52 -08:00 committed by GitHub
parent ce460f9cdb
commit 2bebe6189a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -909,7 +909,18 @@ Status TransformLayoutForEP(Graph& graph, bool& modified, const IExecutionProvid
onnx_layout_transformation::WrapTransposesAroundNode(*api_graph, *node, {&input_perm}, {&output_perm});
}
onnx_layout_transformation::SwapNodeOpTypeAndDomain(*api_graph, *node, node->OpType(), kMSInternalNHWCDomain);
[[maybe_unused]] auto new_node_ref =
onnx_layout_transformation::SwapNodeOpTypeAndDomain(*api_graph, *node, node->OpType(), kMSInternalNHWCDomain);
#if !defined(ORT_MINIMAL_BUILD)
// Set the schema if one is available. This keeps the node equivalent with the state of the original ONNX
// node (if possible - some replacement nodes do not have a schema).
//
Node& new_node = NodeFromApiNode(*new_node_ref);
// add schema if available.
// not guaranteed to be (compiling EP doesn't need schemas, not available in minimal build
graph.SetOpSchemaFromRegistryForNode(new_node);
#endif
modified = true;
}
}