当前位置: 首页>>代码示例>>Python>>正文


Python file_io.delete_file方法代码示例

本文整理汇总了Python中tensorflow.python.lib.io.file_io.delete_file方法的典型用法代码示例。如果您正苦于以下问题:Python file_io.delete_file方法的具体用法?Python file_io.delete_file怎么用?Python file_io.delete_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tensorflow.python.lib.io.file_io的用法示例。


在下文中一共展示了file_io.delete_file方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: end

# 需要导入模块: from tensorflow.python.lib.io import file_io [as 别名]
# 或者: from tensorflow.python.lib.io.file_io import delete_file [as 别名]
def end(self, session):
        if self.mode == tf.estimator.ModeKeys.EVAL:
            current_global_step = session.run(self.global_step_tensor)
            with open(os.path.join(self.writer.get_logdir(), "checkpoint")) as f:
                checkpoints = [ckpt for ckpt in f]
                checkpoints = [self.extract_global_step(ckpt) for ckpt in checkpoints[1:]]
                checkpoints = list(filter(lambda gs: gs < current_global_step, checkpoints))
                if len(checkpoints) > self.keep_eval_results_max_epoch:
                    checkpoint_to_delete = checkpoints[-self.keep_eval_results_max_epoch]
                    tf.logging.info("Deleting %s results at the step %d", self.mode, checkpoint_to_delete)
                    tfrecord_filespec = os.path.join(self.writer.get_logdir(),
                                                     "eval_result_step{:09d}_*.tfrecord".format(checkpoint_to_delete))
                    alignment_filespec = os.path.join(self.writer.get_logdir(),
                                                      "alignment_eval_result_step{:09d}_*.png".format(
                                                          checkpoint_to_delete))
                    mel_filespec = os.path.join(self.writer.get_logdir(),
                                                "mel_eval_result_step{:09d}_*.png".format(checkpoint_to_delete))
                    for pathname in tf.gfile.Glob([tfrecord_filespec, alignment_filespec, mel_filespec]):
                        file_io.delete_file(pathname) 
开发者ID:nii-yamagishilab,项目名称:tacotron2,代码行数:21,代码来源:hooks.py

示例2: _delete_file_if_exists

# 需要导入模块: from tensorflow.python.lib.io import file_io [as 别名]
# 或者: from tensorflow.python.lib.io.file_io import delete_file [as 别名]
def _delete_file_if_exists(self, filespec):
    for pathname in file_io.get_matching_files(filespec):
      file_io.delete_file(pathname) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:5,代码来源:saver.py

示例3: create_object_test

# 需要导入模块: from tensorflow.python.lib.io import file_io [as 别名]
# 或者: from tensorflow.python.lib.io.file_io import delete_file [as 别名]
def create_object_test():
  """Verifies file_io's object manipulation methods ."""
  starttime = int(round(time.time() * 1000))
  dir_name = "%s/tf_gcs_test_%s" % (FLAGS.gcs_bucket_url, starttime)
  print("Creating dir %s." % dir_name)
  file_io.create_dir(dir_name)

  # Create a file in this directory.
  file_name = "%s/test_file.txt" % dir_name
  print("Creating file %s." % file_name)
  file_io.write_string_to_file(file_name, "test file creation.")

  list_files_pattern = "%s/test_file*.txt" % dir_name
  print("Getting files matching pattern %s." % list_files_pattern)
  files_list = file_io.get_matching_files(list_files_pattern)
  print(files_list)

  assert len(files_list) == 1
  assert files_list[0] == file_name

  # Cleanup test files.
  print("Deleting file %s." % file_name)
  file_io.delete_file(file_name)

  # Delete directory.
  print("Deleting directory %s." % dir_name)
  file_io.delete_recursively(dir_name) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:29,代码来源:gcs_smoke.py

示例4: _delete_file_if_exists

# 需要导入模块: from tensorflow.python.lib.io import file_io [as 别名]
# 或者: from tensorflow.python.lib.io.file_io import delete_file [as 别名]
def _delete_file_if_exists(self, filespec):
        for pathname in file_io.get_matching_files(filespec):
            s = os.stat(pathname)[stat.ST_MODE]
            if not (s & stat.S_IWUSR):      # skip read-only file
                continue
            file_io.delete_file(pathname) 
开发者ID:YutingZhang,项目名称:lmdis-rep,代码行数:8,代码来源:tf_graph_utils.py


注:本文中的tensorflow.python.lib.io.file_io.delete_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。