Skip to content

tf-1.10.1 freeze_graph 'list index out of range' #22029

Closed
@jiarenyf

Description

@jiarenyf

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes.
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 1.10.1
  • Python version: 2.7.12
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version: 9.0 / 7.1
  • GPU model and memory: N/A
  • Exact command to reproduce: N/A

Describe the problem

I use the following command to freeze a ckpt file to pb file:

    freeze_graph(
        input_saver=None,
        input_graph=pbTxt,
        input_binary=False,
        clear_devices=True,
        output_graph=pbPath,
        restore_op_name=None,
        initializer_nodes="",
        input_meta_graph=None,
        filename_tensor_name=None,
        input_saved_model_dir=None,
        output_node_names=outputOp,
        variable_names_blacklist='',
        input_checkpoint=iCheckpoint,
    )

In tf-1.8.0 everything seems well, however in tf-1.10.1, I meet the following error:

  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/tools/freeze_graph.py", line 254, in freeze_graph
    checkpoint_version=checkpoint_version)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/tools/freeze_graph.py", line 128, in freeze_graph_with_def_protos
    var_list=var_list, write_version=checkpoint_version)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1281, in __init__
    self.build()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1293, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1330, in _build
    build_save=build_save, build_restore=build_restore)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 756, in _build_internal
    saveables = self._ValidateAndSliceInputs(names_to_saveables)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 663, in _ValidateAndSliceInputs
    for converted_saveable_object in self.SaveableObjectsForOp(op, name):
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 637, in SaveableObjectsForOp
    variable, "", name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 121, in __init__
    self.handle_op = var.op.inputs[0]
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2001, in __getitem__
    return self._inputs[i]
IndexError: list index out of range

I wonder why the tf-1.10 is not tested before release ???

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions