A subgraph may have no inputs (e.g. subgraph in If has no explicit inputs) or value infos (e.g. a subgraph with just an If node in it). (#1083)

It should always have outputs but in case it doesn't (nothing fails currently if it doesn't even though that makes it meaningless) make sure it also has a node.
This commit is contained in:
Scott McKay 2019-09-11 11:03:55 +10:00 committed by GitHub
parent 206278ca44
commit 35c5c4d418
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,9 +47,8 @@ static Status MergeShapeInfo(const std::string& output_name,
}
static bool GraphLoadedFromModelFile(const GraphProto* graph_proto) {
return graph_proto && (graph_proto->input_size() != 0 ||
graph_proto->output_size() != 0 ||
graph_proto->value_info_size() != 0);
return graph_proto && (graph_proto->node_size() != 0 ||
graph_proto->output_size() != 0);
}
// there are some known invalid usages of dim_param and dim_value. remove them from the TypeProto so that
@ -1353,7 +1352,7 @@ Status Graph::InferAndVerifySubgraphTypes(const Node& node, Graph& subgraph,
" inputs and requires ", num_required_subgraph_inputs,
" inputs. Either provide all subgraph inputs, or just the required inputs.");
}
subgraph_inputs = &required_subgraph_inputs;
num_subgraph_inputs = num_required_subgraph_inputs;
}