Tensorflow1.0之后模型文件、权重数值的读取方式是什么-创新互联

本篇内容主要讲解“Tensorflow1.0之后模型文件、权重数值的读取方式是什么”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Tensorflow1.0之后模型文件、权重数值的读取方式是什么”吧!

创新互联公司专注于泰宁企业网站建设,成都响应式网站建设公司,商城网站建设。泰宁网站建设公司,为泰宁等地区提供建站服务。全流程定制设计,专业设计,全程项目跟踪,创新互联公司专业和态度为您提供的服务

保存的文件有4个:

checkpoint

model-parameters.bin-46000.data-00000-of-00001

model-parameters.bin-46000.index

model-parameters.bin-46000.meta

读取代码:

from tensorflow.python import pywrap_tensorflowwith tf.Graph().as_default(): with tf.Session() as sess: ckpt = tf.train.get_checkpoint_state('./checkpoint') if ckpt and ckpt.model_checkpoint_path:  reader = pywrap_tensorflow.NewCheckpointReader('./checkpoint/model-parameters.bin-46000')  all_variables = reader.get_variable_to_shape_map()  w1 = reader.get_tensor("conv1/weight")  print(w1.shape)  print(w1)  print(all_variables) else:  print('No checkpoint file found')

到此,相信大家对“Tensorflow1.0之后模型文件、权重数值的读取方式是什么”有了更深的了解,不妨来实际操作一番吧!这里是创新互联建站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!


标题名称:Tensorflow1.0之后模型文件、权重数值的读取方式是什么-创新互联
网站路径:http://myzitong.com/article/dhecpp.html