tensorflow常用函数笔记3

版权声明: https://blog.csdn.net/Dorothy_Xue/article/details/84979049

20. tf.train.Saver()

功能:训练网络后想保存训练好的模型,以及在程序中读取以保存的训练好的模型。

保存和恢复都需要实例化一个 tf.train.Saver()

saver = tf.train.Saver()

21. tf.gfile.Exists()

功能:判断路径filename是否存在,filename可以是文件路径也可以是文件夹路径。

tf.gfile.Exists(filename)

22. tf.summary.FileWriter()

tf.summary.FileWriter("log",tf.get_default_graph())
  • log是事件文件所在的目录
  • 第二个参数是事件文件要记录的图

23. time time()

time.time()

功能:返回当前时间的时间戳(1970纪元后经过的浮点秒数)。

24. tf.app.run()

它是函数入口,通过处理flag解析,然后执行main函数(或者接下来提到的xxx())(最后含有tf.app.run()的文件,在此行之前肯定能找到def main(_)或者在tf.app.run(xxx())之前找到def xxx().)

猜你喜欢

转载自blog.csdn.net/Dorothy_Xue/article/details/84979049