Skip to content

Commit

Permalink
fix missing functions
Browse files Browse the repository at this point in the history
Signed-off-by: AlexHJH <[email protected]>
  • Loading branch information
AlexHJH committed Aug 7, 2023
1 parent 31fcdec commit 36d561f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions onnxoptimizer/optimize.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,23 @@ struct Optimizer {
ModelProto mp_out = PrepareOutput(mp_in);
this->pass_manager->run(*g);
ExportModelProto(&mp_out, g);

// Maybe we can optimize these functions, now just copy
AddFunctionsToModel(mp_in, mp_out);
return mp_out;
}

private:
std::shared_ptr<PassManager> pass_manager;

void AddFunctionsToModel(const ModelProto &original_model,
ModelProto &output_model) {
for (const auto& function_proto : original_model.functions()) {
auto* p_f = output_model.add_functions();
p_f->CopyFrom(function_proto);
}
}

ModelProto AddInitializerToInput(const ModelProto &original_model) {
ModelProto model = original_model;
std::vector<std::string> input_names;
Expand Down

0 comments on commit 36d561f

Please sign in to comment.