How do I find the variable names and values that are saved in a checkpoint?

后端 未结 5 493
执笔经年
执笔经年 2020-12-12 18:26

I want to see the variables that are saved in a TensorFlow checkpoint along with their values. How can I find the variable names that are saved in a TensorFlow checkpoint?

5条回答
  •  遥遥无期
    2020-12-12 18:43

    You can use the inspect_checkpoint.py tool.

    So, for example, if you stored the checkpoint in the current directory, then you can print the variables and their values as follows

    import tensorflow as tf
    from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file
    
    
    latest_ckp = tf.train.latest_checkpoint('./')
    print_tensors_in_checkpoint_file(latest_ckp, all_tensors=True, tensor_name='')
    

提交回复
热议问题