tensorflow: TypeError in freeze_graph tool while trying to freeze a graph in Tensorflow 1.3

I train a tf.contrib.learn estimator (specifically, DNNLinearCombineRegressor) in Python and saved the model’s parameters and graph by specifying model_dir when defining the estimator. My estimator uses embedding and real valued feature columns, and a custom input_fn to parse the data. After training is done, I try to freeze the graph using the CLI as mentioned in this post, and get this error – TypeError: names_to_saveables must be a dict mapping string names to Tensors/Variables. Not a variable: Tensor("dnn/hiddenlayer_0/biases:0", shape=(10,), dtype=float32) in saver.py in the function _ValidateAndSliceInputs. Is this because I am using an input_fn with pandas dataframe, or is it because of the tf.feature_columns that I am using?

I want to freeze the graph so that predict_scores() doesnt reload the graph variables from checkpoint file everytime for prediction. I am using Tensorflow 1.3 with Anaconda Python 3.5 on Windows 10.

Thanks in advance.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (5 by maintainers)

Most upvoted comments

@drpngx Thanks for your suggestion. However, on StackOverflow there are a lot of open issues without answers.

I also have an issue, which @rutadesai and @xia-sun have. Would be nice to have any suggestions how can it be solved.