tensorflow模型保存函数为:
saver = tf.train.Saver()
查看该函数初始化函数,输入参数为:
def __init__(self,
var_list=None,
reshape=False,
sharded=False,
max_to_keep=5,
keep_checkpoint_every_n_hours=10000.0,
name=None,
restore_sequentially=False,
saver_def=None,
builder=None,
defer_build=False,
allow_empty=False,
write_version=saver_pb2.SaverDef.V2,
pad_step_number=False,
save_relative_paths=False):
var_list参数为我们需要保存的变量数组,如果不输入var_list,则默认保存所有的变量.例如下面代码:
import tensorflow as tf
v1= tf.Variable(tf.random_normal([784, 200], stddev=0.35), name=