Add pruning steps to saved model importer paths
PiperOrigin-RevId: 305147277 Change-Id: I0daaa9735063484f3064b77e392e555456453bc3
This commit is contained in:
parent
47816940ea
commit
b91970316f
@ -2863,6 +2863,7 @@ StatusOr<mlir::OwningModuleRef> SavedModelObjectGraphImporter::Convert(
|
||||
saved_model->debug_info() ? *saved_model->debug_info() : dummy_debug_info;
|
||||
|
||||
GraphImportConfig specs;
|
||||
specs.prune_unused_nodes = true;
|
||||
mlir::OwningModuleRef module =
|
||||
mlir::ModuleOp::create(mlir::UnknownLoc::get(context));
|
||||
std::unordered_map<std::string, std::string> tf_name_to_mlir_name;
|
||||
@ -2888,6 +2889,8 @@ StatusOr<mlir::OwningModuleRef> SavedModelObjectGraphImporter::Convert(
|
||||
module.get(), &tf_name_to_mlir_name,
|
||||
&function_name_uniquifier);
|
||||
|
||||
TF_RETURN_IF_ERROR(importer.PrepareConvert(graph));
|
||||
|
||||
auto fn_names = graph.flib_def().ListFunctionNames();
|
||||
for (const auto& fn_name : fn_names) {
|
||||
TF_RETURN_IF_ERROR(importer.ConvertLibFunction(fn_name));
|
||||
@ -3026,6 +3029,7 @@ Status SavedModelSignatureDefImporter::ConvertSignature(
|
||||
});
|
||||
|
||||
GraphImportConfig specs;
|
||||
specs.prune_unused_nodes = true;
|
||||
specs.inputs = ParseInputArrays(inputs);
|
||||
for (auto& output : outputs) specs.outputs.push_back(output.second.name());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user