From 3fba8ebd60ce65bda2d64290ef3c555c5f58c954 Mon Sep 17 00:00:00 2001 From: cjh9368 Date: Mon, 12 Apr 2021 10:50:32 +0800 Subject: [PATCH] [MS][LITE] solve const fold bug for conv op --- mindspore/lite/tools/anf_exporter/anf_exporter.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mindspore/lite/tools/anf_exporter/anf_exporter.cc b/mindspore/lite/tools/anf_exporter/anf_exporter.cc index 4576a286ed..7ba679991b 100644 --- a/mindspore/lite/tools/anf_exporter/anf_exporter.cc +++ b/mindspore/lite/tools/anf_exporter/anf_exporter.cc @@ -669,7 +669,9 @@ int AnfExporter::ConvertInputParameter(const std::shared_ptr &input_ano MS_LOG(ERROR) << "schema tensor format is wrong, " << schema_tensor->format; return RET_ERROR; } - if (primitive_c->GetAttr(opt::kWeightFormat) != nullptr) { + + // attr weightFormat is only used by conv-like ops' second input + if (output_cnode->inputIndex.size() == 1 && primitive_c->GetAttr(opt::kWeightFormat) != nullptr) { schema_tensor->format = static_cast(GetValue(primitive_c->GetAttr(opt::kWeightFormat))); } schema_tensor->name = param_node->name();