Add support for opset 11 in reshape fusion (#2592)

Support opset verion 11 in reshape fusion
This commit is contained in:
Tianlei Wu 2019-12-10 10:29:41 -08:00 committed by GitHub
parent 35ceb1a6a6
commit 6858f0a06a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,7 +72,7 @@ bool ReshapeFusion::Fuse_Subgraph1(Node& reshape, Graph& graph, const logging::L
}
const Node& concat = *p_concat;
if (!graph_utils::IsSupportedOptypeVersionAndDomain(concat, "Concat", {1, 4})) {
if (!graph_utils::IsSupportedOptypeVersionAndDomain(concat, "Concat", {1, 4, 11})) {
return false;
}
@ -83,8 +83,8 @@ bool ReshapeFusion::Fuse_Subgraph1(Node& reshape, Graph& graph, const logging::L
// path 1: [Root] --> Shape --> Gather(indices=0) --> Unsqueeze (axes=0) --> Concat [input 0]
std::vector<graph_utils::EdgeEndToMatch> parent_path{
{0, 0, "Unsqueeze", {1}, kOnnxDomain},
{0, 0, "Gather", {1}, kOnnxDomain},
{0, 0, "Unsqueeze", {1, 11}, kOnnxDomain},
{0, 0, "Gather", {1, 11}, kOnnxDomain},
{0, 0, "Shape", {1}, kOnnxDomain}};
std::vector<const Node::EdgeEnd*> edges;
@ -114,8 +114,8 @@ bool ReshapeFusion::Fuse_Subgraph1(Node& reshape, Graph& graph, const logging::L
// path 2: [Root] --> Shape --> Gather(indices=1) --> Unsqueeze (axes=0) --> Concat [input 1]
std::vector<graph_utils::EdgeEndToMatch> parent_path2 {
{0, 1, "Unsqueeze", {1}, kOnnxDomain},
{0, 0, "Gather", {1}, kOnnxDomain},
{0, 1, "Unsqueeze", {1, 11}, kOnnxDomain},
{0, 0, "Gather", {1, 11}, kOnnxDomain},
{0, 0, "Shape", {1}, kOnnxDomain}};
if (!graph_utils::FindPath(concat, true, parent_path2, edges, logger)) {