如果发现tf代码运行的时候GPU memery占用,GPU没有进行运算,但有没有报错
这很有可能是数据集出错啦,可能没有读入数据集,即数据集为空。
1. 打印变量
tvars = tf.trainable_variable
#tt = sess.run(tvars) #把值给打印出来了
print(tvars,'++++++++++++++++')
2.打印ckpt中的变量
http://blog.csdn.net/uestc_c2_403/article/details/72383827
import tensorflow as tf;
import numpy as np;
import matplotlib.pyplot as plt;
reader = tf.train.NewCheckpointReader("/home/penglu/Desktop/lp/model.ckpt")
variables = reader.get_variable_to_shape_map()
for ele in variables:
print ele
3.在checkpoint文件中会出现一个变量三个形式
https://stackoverflow.com/questions/41191240/what-is-conv1-weights-adam-in-checkpoint-file-in-tensorflow
https://stackoverflow.com/questions/42397490/update-tensorflow-checkpoint-files-to-1-0
wfo (DT_FLOAT)
wfo/Adam (DT_FLOAT)
wfo/Adam_1 (DT_FLOAT)
You're using the Adam optimizer (https://arxiv.org/abs/1412.6980) for optimization. Adam has two state variables to store statistics about the gradients which are the same size as the parameters (Algorithm 1), which is your two additional variables per parameter variable. The optimizer itself has a few hyperparameters, among them β1
and β2 which I guess are in your case stored as variables.
这是一个额外的变量,因为使用AdamOptimizer()来训练您的数据
4. TensorFlow, why there are 3 files after saving the model?
The .meta file describes the saved graph structure, so you need to import it before restoring the checkpoint (otherwise it doesn't know what variables the saved checkpoint values correspond to).
Even though there is no file named model.ckpt, you still refer to the saved checkpoint by that name when restoring it.
meta file: describes the saved graph structure, includes GraphDef, SaverDef, and so on; then apply tf.train.import_meta_graph('/tmp/model.ckpt.meta'), will restore Saver and Graph.
index file: it is a string-string immutable table(tensorflow::table::Table). Each key is a name of a tensor and its value is a serialized BundleEntryProto. Each BundleEntryProto describes the metadata of a tensor: which of the "data" files contains the content of a tensor, the offset into that file, checksum, some auxiliary data, etc.
data file: it is TensorBundle collection, save the values of all variables.
网友评论