Python tensorflow.python.platform.gfile 模块,DeleteRecursively() 实例源码

我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用tensorflow.python.platform.gfile.DeleteRecursively()

项目:DeepLearning_VirtualReality_BigData_Project    作者:rashmitripathi    | 项目源码 | 文件源码
def garbage_collect_exports(export_dir_base, exports_to_keep):
  """Deletes older exports, retaining only a given number of the most recent.

  Export subdirectories are assumed to be named with monotonically increasing
  integers; the most recent are taken to be those with the largest values.

  Args:
    export_dir_base: the base directory under which each export is in a
      versioned subdirectory.
    exports_to_keep: the number of recent exports to retain.
  """
  if exports_to_keep is None:
    return

  keep_filter = gc.largest_export_versions(exports_to_keep)
  delete_filter = gc.negation(keep_filter)
  for p in delete_filter(gc.get_paths(export_dir_base,
                                      parser=_export_version_parser)):
    gfile.DeleteRecursively(p.path)
项目:lsdc    作者:febert    | 项目源码 | 文件源码
def tearDownModule():
  gfile.DeleteRecursively(tf.test.get_temp_dir())
项目:lsdc    作者:febert    | 项目源码 | 文件源码
def tearDownModule():
  gfile.DeleteRecursively(tf.test.get_temp_dir())
项目:lsdc    作者:febert    | 项目源码 | 文件源码
def tearDownModule():
  gfile.DeleteRecursively(tf.test.get_temp_dir())
项目:lsdc    作者:febert    | 项目源码 | 文件源码
def tearDownModule():
  gfile.DeleteRecursively(tf.test.get_temp_dir())
项目:TensorFlow    作者:DiamonJoy    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  cifar10.maybe_download_and_extract()
  if gfile.Exists(FLAGS.train_dir):
    gfile.DeleteRecursively(FLAGS.train_dir)
  gfile.MakeDirs(FLAGS.train_dir)
  train()
项目:TensorFlow    作者:DiamonJoy    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  cifar10.maybe_download_and_extract()
  if gfile.Exists(FLAGS.train_dir):
    gfile.DeleteRecursively(FLAGS.train_dir)
  else:
    gfile.MakeDirs(FLAGS.train_dir)
  train()
项目:TensorFlow    作者:DiamonJoy    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  cifar10.maybe_download_and_extract()
  if gfile.Exists(FLAGS.eval_dir):
    gfile.DeleteRecursively(FLAGS.eval_dir)
  gfile.MakeDirs(FLAGS.eval_dir)
  evaluate()
项目:Gating-types-for-Residual-Networks    作者:luong-vinh    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  setConfig()
  config = network_config.getConfig()
  train_dir = config['train_dir']

  cifar10.maybe_download_and_extract()
  if gfile.Exists(train_dir):
    gfile.DeleteRecursively(train_dir)
  gfile.MakeDirs(train_dir)
  train()
项目:Gating-types-for-Residual-Networks    作者:luong-vinh    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  # Have to set config first
  # TODO: remove the need for this, will check how Python initialize a module
  setConfig()
  cifar10.maybe_download_and_extract()
  config = network_config.getConfig()
  train_dir = config['train_dir']
  if gfile.Exists(train_dir):
    gfile.DeleteRecursively(train_dir)
  gfile.MakeDirs(train_dir)
  train()
项目:Gating-types-for-Residual-Networks    作者:luong-vinh    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  setConfig()
  config = network_config.getConfig()
  train_dir = config['train_dir']

  cifar10.maybe_download_and_extract()
  if gfile.Exists(train_dir):
    gfile.DeleteRecursively(train_dir)
  gfile.MakeDirs(train_dir)
  train()
项目:Gating-types-for-Residual-Networks    作者:luong-vinh    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  # Have to set config first
  # TODO: remove the need for this, will check how Python initialize a module
  setConfig()
  cifar10.maybe_download_and_extract()
  config = network_config.getConfig()
  train_dir = config['train_dir']
  if gfile.Exists(train_dir):
    gfile.DeleteRecursively(train_dir)
  gfile.MakeDirs(train_dir)
  train()
项目:Gating-types-for-Residual-Networks    作者:luong-vinh    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  # Have to set config first
  # TODO: remove the need for this, will check how Python initialize a module
  setConfig()
  cifar10.maybe_download_and_extract()
  config = network_config.getConfig()
  train_dir = config['train_dir']
  if gfile.Exists(train_dir):
    gfile.DeleteRecursively(train_dir)
  gfile.MakeDirs(train_dir)
  train()
项目:BinaryNet.tf    作者:itayhubara    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
    if not gfile.Exists(FLAGS.checkpoint_dir):
        # gfile.DeleteRecursively(FLAGS.checkpoint_dir)
        gfile.MakeDirs(FLAGS.checkpoint_dir)
        model_file = os.path.join('models', FLAGS.model + '.py')
        assert gfile.Exists(model_file), 'no model file named: ' + model_file
        gfile.Copy(model_file, FLAGS.checkpoint_dir + '/model.py')
    m = importlib.import_module('.' + FLAGS.model, 'models')
    data = get_data_provider(FLAGS.dataset, training=True)

    train(m.model, data,
          batch_size=FLAGS.batch_size,
          checkpoint_dir=FLAGS.checkpoint_dir,
          log_dir=FLAGS.log_dir,
          num_epochs=FLAGS.num_epochs)
项目:tensorflow.cifar10    作者:yhlleo    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  cifar10.maybe_download_and_extract()
  if gfile.Exists(FLAGS.train_dir):
    gfile.DeleteRecursively(FLAGS.train_dir)
  gfile.MakeDirs(FLAGS.train_dir)
  train()
项目:tensorflow.cifar10    作者:yhlleo    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  cifar10.maybe_download_and_extract()
  if gfile.Exists(FLAGS.train_dir):
    gfile.DeleteRecursively(FLAGS.train_dir)
  gfile.MakeDirs(FLAGS.train_dir)
  train()
项目:tensorflow.cifar10    作者:yhlleo    | 项目源码 | 文件源码
def main(argv=None):  # pylint: disable=unused-argument
  cifar10.maybe_download_and_extract()
  if gfile.Exists(FLAGS.eval_dir):
    gfile.DeleteRecursively(FLAGS.eval_dir)
  gfile.MakeDirs(FLAGS.eval_dir)
  evaluate()
项目:DeepLearning_VirtualReality_BigData_Project    作者:rashmitripathi    | 项目源码 | 文件源码
def testLoadExistingVariables(self):
    model_dir = tempfile.mkdtemp(prefix=os.path.join(self.get_temp_dir(),
                                                     'load_existing_variables'))
    if gfile.Exists(model_dir):
      gfile.DeleteRecursively(model_dir)

    init_value0 = 10.0
    init_value1 = 20.0
    var_names_to_values = {'v0': init_value0, 'v1': init_value1}

    with self.test_session() as sess:
      model_path = self.create_checkpoint_from_values(var_names_to_values,
                                                      model_dir)
      var0 = variables_lib2.variable('my_var0', shape=[])
      var1 = variables_lib2.variable('my_var1', shape=[])

      vars_to_restore = {'v0': var0, 'v1': var1}
      init_fn = variables_lib2.assign_from_checkpoint_fn(model_path,
                                                         vars_to_restore)

      # Initialize the variables.
      sess.run(variables_lib.global_variables_initializer())

      # Perform the assignment.
      init_fn(sess)

      # Request and test the variable values:
      self.assertEqual(init_value0, var0.eval())
      self.assertEqual(init_value1, var1.eval())
项目:DeepLearning_VirtualReality_BigData_Project    作者:rashmitripathi    | 项目源码 | 文件源码
def testLoadExistingVariablesDifferentShapeDefaultDoesNotAllowReshape(self):
    model_dir = tempfile.mkdtemp(prefix=os.path.join(
        self.get_temp_dir(), 'load_existing_vars_no_reshape'))
    if gfile.Exists(model_dir):
      gfile.DeleteRecursively(model_dir)

    init_value0 = [[10.0, 11.0]]
    init_value1 = 20.0
    var_names_to_values = {'v0': init_value0, 'v1': init_value1}

    with self.test_session() as sess:
      model_path = self.create_checkpoint_from_values(var_names_to_values,
                                                      model_dir)
      var0 = variables_lib2.variable('my_var0', shape=[2, 1])
      var1 = variables_lib2.variable('my_var1', shape=[])

      vars_to_restore = {'v0': var0, 'v1': var1}
      init_fn = variables_lib2.assign_from_checkpoint_fn(model_path,
                                                         vars_to_restore)

      # Initialize the variables.
      sess.run(variables_lib.global_variables_initializer())

      # Perform the assignment.
      with self.assertRaises(errors_impl.InvalidArgumentError):
        init_fn(sess)
项目:DeepLearning_VirtualReality_BigData_Project    作者:rashmitripathi    | 项目源码 | 文件源码
def testLoadExistingVariablesDifferentShapeAllowReshape(self):
    model_dir = tempfile.mkdtemp(prefix=os.path.join(
        self.get_temp_dir(),
        'load_existing_variables_different_shape_allow_reshape'))
    if gfile.Exists(model_dir):
      gfile.DeleteRecursively(model_dir)

    init_value0 = [[10.0, 11.0]]
    init_value1 = 20.0
    var_names_to_values = {'v0': init_value0, 'v1': init_value1}

    with self.test_session() as sess:
      model_path = self.create_checkpoint_from_values(var_names_to_values,
                                                      model_dir)
      var0 = variables_lib2.variable('my_var0', shape=[2, 1])
      var1 = variables_lib2.variable('my_var1', shape=[])

      vars_to_restore = {'v0': var0, 'v1': var1}
      init_fn = variables_lib2.assign_from_checkpoint_fn(
          model_path, vars_to_restore, reshape_variables=True)

      # Initialize the variables.
      sess.run(variables_lib.global_variables_initializer())

      # Perform the assignment.
      init_fn(sess)

      # Request and test the variable values:
      self.assertAllEqual(np.transpose(np.array(init_value0)), var0.eval())
      self.assertEqual(init_value1, var1.eval())
项目:DeepLearning_VirtualReality_BigData_Project    作者:rashmitripathi    | 项目源码 | 文件源码
def testNotFoundError(self):
    model_dir = tempfile.mkdtemp(prefix=os.path.join(self.get_temp_dir(),
                                                     'not_found_error'))
    if gfile.Exists(model_dir):
      gfile.DeleteRecursively(model_dir)

    init_value0 = 10.0
    init_value1 = 20.0
    var_names_to_values = {'v0': init_value0, 'v1': init_value1}

    with self.test_session() as sess:
      model_path = self.create_checkpoint_from_values(var_names_to_values,
                                                      model_dir)
      var0 = variables_lib2.variable('my_var0', shape=[])
      var1 = variables_lib2.variable('my_var1', shape=[])
      var2 = variables_lib2.variable('my_var2', shape=[])

      vars_to_restore = {'v0': var0, 'v1': var1, 'v2': var2}
      init_fn = variables_lib2.assign_from_checkpoint_fn(model_path,
                                                         vars_to_restore)

      # Initialize the variables.
      sess.run(variables_lib.global_variables_initializer())

      # Perform the assignment.
      with self.assertRaises(errors_impl.NotFoundError):
        init_fn(sess)
项目:DeepLearning_VirtualReality_BigData_Project    作者:rashmitripathi    | 项目源码 | 文件源码
def testMissingVariablesList(self):
    model_dir = tempfile.mkdtemp(prefix=os.path.join(self.get_temp_dir(),
                                                     'missing_variables_list'))
    if gfile.Exists(model_dir):
      gfile.DeleteRecursively(model_dir)

    init_value0 = 10.0
    init_value1 = 20.0
    var_names_to_values = {'v0': init_value0, 'v1': init_value1}

    with self.test_session() as sess:
      model_path = self.create_checkpoint_from_values(var_names_to_values,
                                                      model_dir)
      var0 = variables_lib2.variable('v0', shape=[])
      var1 = variables_lib2.variable('v1', shape=[])
      var2 = variables_lib2.variable('v2', shape=[])

      vars_to_restore = [var0, var1, var2]
      init_fn = variables_lib2.assign_from_checkpoint_fn(
          model_path, vars_to_restore, ignore_missing_vars=True)

      # Initialize the variables.
      sess.run(variables_lib.global_variables_initializer())

      # Perform the assignment.
      init_fn(sess)

      # Request and test the variable values:
      self.assertEqual(init_value0, var0.eval())
      self.assertEqual(init_value1, var1.eval())
项目:DeepLearning_VirtualReality_BigData_Project    作者:rashmitripathi    | 项目源码 | 文件源码
def tearDownModule():
  gfile.DeleteRecursively(test.get_temp_dir())