diff options
author | Kevin Cheng <kevin.cheng@arm.com> | 2021-02-22 15:22:22 -0800 |
---|---|---|
committer | Kevin Cheng <kevin.cheng@arm.com> | 2021-02-22 15:22:22 -0800 |
commit | df8626976df6c779bb30df9c5ceef689462109c0 (patch) | |
tree | e2a12296bc36063dbb0793281d24ef9180565ccb | |
parent | 3a4785772a0f076e2e9653ad70dbb2fc412ac302 (diff) | |
download | reference_model-df8626976df6c779bb30df9c5ceef689462109c0.tar.gz |
Fix operator initialization bug when rank/dtype fails to initialize with Usage arrays
Signed-off-by: Kevin Cheng <kevin.cheng@arm.com>
Change-Id: Iefa2959996871d06b766dadbc4cba601e2e739fe
-rw-r--r-- | reference_model/src/subgraph_traverser.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/reference_model/src/subgraph_traverser.cc b/reference_model/src/subgraph_traverser.cc index 789bcae..082f802 100644 --- a/reference_model/src/subgraph_traverser.cc +++ b/reference_model/src/subgraph_traverser.cc @@ -130,6 +130,22 @@ int SubgraphTraverser::initializeGraph() } } + // if dtype/rank still not initialized with above pass, we initialize without Usage check + if (in_dtype == DType_UNKNOWN && in_rank == 0) + { + for (auto name : op->GetInputTensorNames()) + { + TosaSerializationTensor* ts = block->GetTensorByName(name); + ASSERT_MSG(ts, "SubgraphTraverser: fail to get tensor %s from TosaSerializationHandler", name.c_str()); + + if (ts->GetShape().size() >= in_rank) + { + in_dtype = ts->GetDtype(); + in_rank = ts->GetShape().size(); + } + } + } + for (auto name : op->GetOutputTensorNames()) { |