From df8626976df6c779bb30df9c5ceef689462109c0 Mon Sep 17 00:00:00 2001 From: Kevin Cheng Date: Mon, 22 Feb 2021 15:22:22 -0800 Subject: Fix operator initialization bug when rank/dtype fails to initialize with Usage arrays Signed-off-by: Kevin Cheng Change-Id: Iefa2959996871d06b766dadbc4cba601e2e739fe --- reference_model/src/subgraph_traverser.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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()) { -- cgit v1.2.1