Add check that the first 2 Loop subgraph inputs have an shape (could be explicit or inferred) as we need to know the rank the subgraph expects. Other inputs to the subgraph are more opaque so we can just pass them through. (#6891)

This commit is contained in:
Scott McKay 2021-03-04 20:42:40 +10:00 committed by GitHub
parent d01006fc22
commit 54cdb6af71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -399,6 +399,12 @@ Status LoopImpl::Initialize() {
auto& subgraph_inputs = info_.subgraph.GetInputs();
// we need to know if the subgraph expects a rank 0 or rank 1 value for these, so a shape is required.
ORT_RETURN_IF(subgraph_inputs[0]->Shape() == nullptr, "Loop subgraph input 0 has unknown shape: ",
subgraph_inputs[0]->Name());
ORT_RETURN_IF(subgraph_inputs[1]->Shape() == nullptr, "Loop subgraph input 1 has unknown shape: ",
subgraph_inputs[1]->Name());
auto iter_num_rank = subgraph_inputs[0]->Shape()->dim_size();
auto condition_rank = subgraph_inputs[1]->Shape()->dim_size();