def init(self, var_list=None, ckpt_dir=None, ckpt_file=None, optimistic=False):
    '\n        :param var_list:    vars for restore\n        :param ckpt_dir:    prefix of model files.\n        :param ckpt_file:   exact name of model file, priority is higher than `ckpt_dir`\n        :param optimistic:  only restore weights of same names with model.\n        :return:\n        '
    assert ((var_list is None) or (len(var_list) > 0)), 'invalid var_list: {}'.format(var_list)
    assert ((ckpt_dir is not None) or (ckpt_file is not None)), 'ckpt_dir and ckpt_file are both None'
    self._var_list = var_list
    self._restore_optimistic = optimistic
    if (ckpt_file is None):
        assert os.path.exists(ckpt_dir), ('invalid checkpoint dir: %s' % ckpt_dir)
        self.restore_ckpt_file = tf.train.latest_checkpoint(os.path.dirname((ckpt_dir + os.sep)))
    else:
        self.restore_ckpt_file = ckpt_file
    self._inited = True
    return self
:param var_list:    vars for restore
:param ckpt_dir:    prefix of model files.
:param ckpt_file:   exact name of model file, priority is higher than `ckpt_dir`
:param optimistic:  only restore weights of same names with model.
:return:
def init(self, var_list=None, ckpt_dir=None, ckpt_file=None, optimistic=False):
    '\n        :param var_list:    vars for restore\n        :param ckpt_dir:    prefix of model files.\n        :param ckpt_file:   exact name of model file, priority is higher than `ckpt_dir`\n        :param optimistic:  only restore weights of same names with model.\n        :return:\n        '
    assert ((var_list is None) or (len(var_list) > 0)), 'invalid var_list: {}'.format(var_list)
    assert ((ckpt_dir is not None) or (ckpt_file is not None)), 'ckpt_dir and ckpt_file are both None'
    self._var_list = var_list
    self._restore_optimistic = optimistic
    if (ckpt_file is None):
        assert os.path.exists(ckpt_dir), ('invalid checkpoint dir: %s' % ckpt_dir)
        self.restore_ckpt_file = tf.train.latest_checkpoint(os.path.dirname((ckpt_dir + os.sep)))
    else:
        self.restore_ckpt_file = ckpt_file
    self._inited = True
    return self