I have a existing tensorflow saved model with the directory structure below. That is basically the only thing I have. I can manage to get the checkpoint files though, but it would be great if we don’t need anything from training procedure.
saved_model.pb variables/ variables.data-00000-of-00001 variables.idnex
Now I would like to run the
tensorflow.python.tools.optimize_for_inference to optimize it for later inference in tf serving.
However, even though I can successfully optimize its graph_def, I cannot prepare appropriate variables for the new graph. The problem reside in the
Restore op, which exists in the old graph, but are pruned in the optimized graph_def.
But the variables file contains the save/restore op, it will give errors like
Save/xxxdoes not exist in graph.
I tried to leverage the
graph_util.convert_variables_to_constant function, but I got the
Attempting to use unitialized node xxx/yyy
How can I prune the graph structure and make successfull predictions? Thanks.