Browse Source

!4565 fix post training quant

Merge pull request !4565 from xutianchun/quant_0817
tags/v0.7.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
f20e68a879
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      mindspore/lite/tools/anf_exporter/anf_exporter.cc

+ 12
- 1
mindspore/lite/tools/anf_exporter/anf_exporter.cc View File

@@ -238,7 +238,6 @@ schema::MetaGraphT *AnfExporter::Export(const FuncGraphPtr &func_graph) {
}

meta_graphT->nodes.emplace_back(std::move(node));
primitiveT_value->SetPrimitiveT(nullptr);
}
// set graph input tensors
SetGraphInputIndex(meta_graphT);
@@ -296,6 +295,18 @@ int AnfExporter::ConvertInputParameter(const std::shared_ptr<AnfNode> input_anod
paramTensor->nodeType = schema::NodeType_ValueNode;
paramTensor->data.resize(paramValue->tensor_size());
memcpy(paramTensor->data.data(), paramValue->tensor_addr(), paramValue->tensor_size());
for (auto &ite : paramValue->quant_param()) {
auto quantPar = std::make_unique<schema::QuantParamT>();
quantPar->scale = ite->scale;
quantPar->zeroPoint = ite->zeroPoint;
quantPar->min = ite->zeroPoint;
quantPar->max = ite->max;
quantPar->narrowRange = ite->narrowRange;
quantPar->inited = ite->inited;
quantPar->numBits = ite->numBits;
paramTensor->quantParams.emplace_back(std::move(quantPar));
paramTensor->dataType = paramValue->tensor_type();
}
}
node_id_map_[paramNode->fullname_with_scope()] = meta_graphT->allTensors.size();
output_cnode->inputIndex.emplace_back(meta_graphT->allTensors.size());


Loading…
Cancel
Save