aboutsummaryrefslogtreecommitdiff
path: root/reference_model/src/subgraph_traverser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'reference_model/src/subgraph_traverser.cc')
-rw-r--r--reference_model/src/subgraph_traverser.cc29
1 files changed, 5 insertions, 24 deletions
diff --git a/reference_model/src/subgraph_traverser.cc b/reference_model/src/subgraph_traverser.cc
index 5096ffa..1995b5c 100644
--- a/reference_model/src/subgraph_traverser.cc
+++ b/reference_model/src/subgraph_traverser.cc
@@ -499,7 +499,6 @@ int SubgraphTraverser::linkTensorsAndNodes()
// For each node, read this list, link up the tensors with their inputs/outputs
for (GraphNode* currNode : nodes)
{
-
// Link inputs/consuming nodes
for (std::string& name : currNode->getInputNames())
{
@@ -566,36 +565,18 @@ int SubgraphTraverser::validateGraph()
for (TosaReference::Tensor* currTensor : tensors)
{
- if (!currTensor->getProducer() && currTensor->getConsumers().empty())
- {
- WARNING("Graph inconsistency: TosaReference::Tensor %s has no producers or consumers\n",
- currTensor->getName().c_str());
- return 1;
- }
-
- if (currTensor->getIsSubgraphInput())
+ // It's okay for block input tensor not being consumed by operators.
+ // This is common in control flow op execution.
+ if (!currTensor->getIsSubgraphInput())
{
- if (currTensor->getProducer() && currTensor->getProducer()->getOp() != Op_PLACEHOLDER)
+ if (!currTensor->getProducer() && currTensor->getConsumers().empty())
{
- WARNING("Graph inconsistency: TosaReference::Tensor %s is a subgraph input and has a producer\n",
+ WARNING("Graph inconsistency: TosaReference::Tensor %s has no producers or consumers\n",
currTensor->getName().c_str());
return 1;
}
}
- // comment this check out as this is possible when graph have multiple output
- // for example:
- // %0 = add(%arg0, %arg1)
- // %1 = mul(%arg0, %0)
- // yields(%0, %1)
- //if (currTensor->getIsSubgraphOutput()) {
- // if (!currTensor->getConsumers().empty()) {
- // WARNING ("Graph inconsistency: TosaReference::Tensor %s is a subgraph output and has a consumer\n",
- // currTensor->getName().c_str());
- // return 1;
- // }
- //}
-
if (g_func_config.tosa_profile == 0)
{
DType dtype = currTensor->getDtype();