helper.py 文件源码

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

项目:Triplet_Loss_SBIR 作者: TuBui 项目源码 文件源码
def load(self, file_path, varnum=0):
    """
    load variables that previously saved using self.save()
    varnum : number of variables u want to load (0 mean it will load all)
    Note: if you are loading class instance(s), you must have it defined in advance
    """
    with open(file_path,'rb') as f:
      pickler = pickle.Unpickler(f)
      var_count = pickler.load()
      if varnum:
        var_count = min([var_count,varnum])
      out = {}
      for i in range(var_count):
        key = pickler.load()
        out[key] = pickler.load()

    return out
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号