|
|
@ -15,15 +15,12 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "tools/converter/graphdef_transform.h"
|
|
|
|
#include "tools/converter/graphdef_transform.h"
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <string>
|
|
|
|
#include "schema/model_generated.h"
|
|
|
|
#include "schema/model_generated.h"
|
|
|
|
#include "utils/log_adapter.h"
|
|
|
|
#include "utils/log_adapter.h"
|
|
|
|
#include "src/common/op_utils.h"
|
|
|
|
|
|
|
|
#include "tools/converter/converter_flags.h"
|
|
|
|
#include "tools/converter/converter_flags.h"
|
|
|
|
#include "tools/converter/legacy_optimizer/graph/dtype_trans_pass.h"
|
|
|
|
#include "tools/converter/legacy_optimizer/graph/dtype_trans_pass.h"
|
|
|
|
// #include "tools/converter/legacy_optimizer/fusion/matmul_biasadd_fusion_pass.h"
|
|
|
|
|
|
|
|
#include "tools/converter/legacy_optimizer/fusion/format_trans_fusion_pass.h"
|
|
|
|
#include "tools/converter/legacy_optimizer/fusion/format_trans_fusion_pass.h"
|
|
|
|
#include "tools/converter/legacy_optimizer/fusion/format_trans_transpose_fusion_pass.h"
|
|
|
|
#include "tools/converter/legacy_optimizer/fusion/format_trans_transpose_fusion_pass.h"
|
|
|
|
#include "tools/converter/legacy_optimizer/fusion/quant_cast_fusion_pass.h"
|
|
|
|
#include "tools/converter/legacy_optimizer/fusion/quant_cast_fusion_pass.h"
|
|
|
@ -37,7 +34,6 @@
|
|
|
|
#include "tools/converter/legacy_optimizer/graph/unused_node_remove_pass.h"
|
|
|
|
#include "tools/converter/legacy_optimizer/graph/unused_node_remove_pass.h"
|
|
|
|
#include "tools/converter/legacy_optimizer/graph/topological_sort_pass.h"
|
|
|
|
#include "tools/converter/legacy_optimizer/graph/topological_sort_pass.h"
|
|
|
|
#include "tools/converter/quantizer/aware_quantizer.h"
|
|
|
|
#include "tools/converter/quantizer/aware_quantizer.h"
|
|
|
|
#include "tools/converter/converter.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
using std::string;
|
|
|
|
namespace mindspore::lite {
|
|
|
|
namespace mindspore::lite {
|
|
|
@ -72,7 +68,6 @@ int GraphDefTransform::Transform(const converter::Flags &ctx) {
|
|
|
|
weightHardCodePass->SetFmkType(ctx.fmk);
|
|
|
|
weightHardCodePass->SetFmkType(ctx.fmk);
|
|
|
|
weightFormatPass->SetQuantType(ctx.quantType);
|
|
|
|
weightFormatPass->SetQuantType(ctx.quantType);
|
|
|
|
weightFormatPass->SetFmkType(ctx.fmk);
|
|
|
|
weightFormatPass->SetFmkType(ctx.fmk);
|
|
|
|
// weightFormatPass->SetDstFormat(Format_KHWC);
|
|
|
|
|
|
|
|
weightFormatOptimizer.AddPass(weightHardCodePass);
|
|
|
|
weightFormatOptimizer.AddPass(weightHardCodePass);
|
|
|
|
weightFormatOptimizer.AddPass(weightFormatPass);
|
|
|
|
weightFormatOptimizer.AddPass(weightFormatPass);
|
|
|
|
status = weightFormatOptimizer.Run(graphDefT);
|
|
|
|
status = weightFormatOptimizer.Run(graphDefT);
|
|
|
@ -153,9 +148,6 @@ int GraphDefTransform::Transform(const converter::Flags &ctx) {
|
|
|
|
formatTransOptimizer.AddPass(new EltwiseFormatTransPass());
|
|
|
|
formatTransOptimizer.AddPass(new EltwiseFormatTransPass());
|
|
|
|
formatTransOptimizer.AddPass(new (std::nothrow) FormatTransFusionPass());
|
|
|
|
formatTransOptimizer.AddPass(new (std::nothrow) FormatTransFusionPass());
|
|
|
|
formatTransOptimizer.AddPass(new (std::nothrow) IsolatedNodeRemovePass());
|
|
|
|
formatTransOptimizer.AddPass(new (std::nothrow) IsolatedNodeRemovePass());
|
|
|
|
// if (ctx.quantType == QuantType_AwareTraining) {
|
|
|
|
|
|
|
|
// formatTransOptimizer.AddPass(new (std::nothrow) FormatTransNodeQuantParamFillPass());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
status = formatTransOptimizer.Run(graphDefT);
|
|
|
|
status = formatTransOptimizer.Run(graphDefT);
|
|
|
|
if (status != RET_OK && status != RET_NO_CHANGE) {
|
|
|
|
if (status != RET_OK && status != RET_NO_CHANGE) {
|
|
|
|
MS_LOG(ERROR) << "Run formatTransOptimizer graphPasses Failed";
|
|
|
|
MS_LOG(ERROR) << "Run formatTransOptimizer graphPasses Failed";
|
|
|
|