2021
07-09
07-09
Tensorflow 如何从checkpoint文件中加载变量名和变量值
假设你已经经过上千次的迭代,并且得到了以下模型:则从这些checkpoint文件中加载变量名和变量值代码如下:model_dir='./ckpt-182802'importtensorflowastffromtensorflow.pythonimportpywrap_tensorflowreader=pywrap_tensorflow.NewCheckpointReader(model_dir)var_to_shape_map=reader.get_variable_to_shape_map()forkeyinvar_to_shape_map:print("tensor_name:",key)print(reader.get_tensor(key)...
继续阅读 >