用tensorflow创建文件目录以及删除目录下所有内容

来源:互联网 发布:乐视软件商城 编辑:程序博客网 时间:2024/06/08 16:10
#coding=utf-8import tensorflow as tftf.app.flags.DEFINE_string('checkpoint_path', 'E:/E/test/src/checkpoint', '')tf.app.flags.DEFINE_boolean('restore', False, 'whether to resotre from checkpoint')FLAGS = tf.app.flags.FLAGSprint(FLAGS.checkpoint_path)if not tf.gfile.Exists(FLAGS.checkpoint_path):        tf.gfile.MkDir(FLAGS.checkpoint_path) #创建目录else:    if not FLAGS.restore:        tf.gfile.DeleteRecursively(FLAGS.checkpoint_path) #删除该目录下的全部内容        tf.gfile.MkDir(FLAGS.checkpoint_path)


原创粉丝点击