dm_learner.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:deepmodels 作者: learningsociety 项目源码 文件源码
def set_key_vars(self, restore_scope_exclude, train_scopes):
    """Set critical variables for relevant tasks.

    Set vars_to_train and vars_to_restore.
    Called after build_model.

    Args:
      restore_scope_exclude: variable scopes to exclude for restoring.
      train_scopes: variable scopes to train.
    """
    # self.dm_model.use_graph()
    self.vars_to_restore = slim.get_variables_to_restore(
        exclude=restore_scope_exclude)
    self.vars_to_train = []
    if train_scopes is not None:
      for scope in train_scopes:
        variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope)
        self.vars_to_train.extend(variables)
    if not self.vars_to_train:
      print "[set_key_vars: info] No variables to train were defined." \
            " Will train ALL variables."
      self.vars_to_train = None
    #base_model.print_variable_names(self.vars_to_train)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号