From 1c84c3ebb95da51aca14a71ff7576a0d06cb60c6 Mon Sep 17 00:00:00 2001 From: YdrMaster Date: Mon, 26 Jun 2023 09:36:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B6=88=E9=99=A4=E6=97=A0=E6=95=88?= =?UTF-8?q?=E5=BC=A0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: YdrMaster --- src/apps/model_surgeon.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/apps/model_surgeon.cc b/src/apps/model_surgeon.cc index 0c526798..27505f5e 100644 --- a/src/apps/model_surgeon.cc +++ b/src/apps/model_surgeon.cc @@ -32,6 +32,17 @@ Tensor runWeightComputation(const Tensor &weight) { Graph convertNCHWtoNHWCModel(Graph inG) { // Construct new graph // IT_ASSERT(inG->getInputs().size() == 1); + { + auto useless = vector(); + for (const auto &t : inG->getTensors()) { + if (!t->getSource() && t->getTargets().empty()) { + useless.push_back(t); + } + } + for (auto t : useless) { + inG->removeTensor(t); + } + } IT_ASSERT(inG->getOutputs().size() == 1); bool status = inG->topo_sort(); IT_ASSERT(status);