code: def sg_restore(sess, save_path, category=''):
      r
      # to list
      if not isinstance(category, (tuple, list)):
          category = [category]
  
      # make variable list to load
      var_list = {}
      for cat in category:
          for t in tf.global_variables():
              if t.name.startswith(cat):
                  var_list[t.name[:-2]] = t
  
      # restore parameters
      saver = tf.train.Saver(var_list)
      saver.restore(sess, save_path)
docs: r""" Restores previously saved variables.
  
      Args:
        sess: A `Session` to use to restore the parameters.
        save_path: Path where parameters were previously saved.
        category: A `String` to filter variables starts with given category.
  
      Returns: