StoryCode

Saver 에서 save 후, CheckpointVariables 변수 보기

인공지능,AI,학습,ML,Tensorflow, Cafee2,MLFlow/Tensorflow
반응형

1) 아래 소스 추가


inspect_checkpoint.py


2) Traine 소스에서, 


임포트후,

from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file


저장하고,

ckpt_path = saver.save(sess, 'saved1/train1')


출력하면

print_tensors_in_checkpoint_file(ckpt_path, all_tensors=True, tensor_name='', all_tensor_names=False)


결과가 나온다.

tensor_name:  b_h1_3

[ 1.5395054e-03  0.0000000e+00  1.7294792e-02 -1.9801984e-05

 -3.9077952e-04  1.9007076e-07  2.1687772e-02  1.2043750e-05

  2.5410240e-04  0.0000000e+00]











PS) print_tensors_in_checkpoint_file 파라미터 설명


file_name: not a physical file, just the prefix of filenames

If no tensor_name is provided, prints the tensor names and shapes in the checkpoint file. If tensor_name is provided, prints the content of the tensor.(inspect_checkpoint.py)

If all_tensor_names is True, Prints all the tensor names

If all_tensor is 'True`, Prints all the tensor names and the corresponding content.

N.B. all_tensor and all_tensor_names will override tensor_name

반응형