Skip to content

Commit

Permalink
[e2e] fix tf1 hashtable test (#7904)
Browse files Browse the repository at this point in the history
* initialize graph_def library field if it is not set

* Update tf_saved_model_conversion_v2.py
  • Loading branch information
pyu10055 authored Aug 11, 2023
1 parent 528bcdd commit f4f7cfc
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# Required to load saved models that use TFDF.
import tensorflow_decision_forests
import tensorflow as tf
from tensorflow.core.framework import function_pb2
from tensorflow.core.framework import graph_pb2
from tensorflow.core.framework import node_def_pb2
from tensorflow.core.protobuf import config_pb2
Expand Down Expand Up @@ -432,6 +433,8 @@ def _freeze_saved_model_v1(saved_model_dir, saved_model_tags,
meta_graph = loader.load(sess, saved_model_tags, saved_model_dir)

meta_graph_def = g.as_graph_def()
if not meta_graph_def.HasField('library'):
meta_graph_def.library.CopyFrom(function_pb2.FunctionDefLibrary())

frozen_graph_def = tf.compat.v1.graph_util.convert_variables_to_constants(
sess, meta_graph_def, output_node_names)
Expand Down

0 comments on commit f4f7cfc

Please sign in to comment.