util.py 文件源码

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

项目:pyro 作者: uber 项目源码 文件源码
def parse_torch_version():
    """
    Parses `torch.__version__` into a semver-ish version tuple.
    This is needed to handle subpatch `_n` parts outside of the semver spec.

    :returns: a tuple `(major, minor, patch, extra_stuff)`
    """
    match = re.match(r"(\d\.\d\.\d)(.*)", torch.__version__)
    major, minor, patch = map(int, match.group(1).split("."))
    extra_stuff = match.group(2)
    return major, minor, patch, extra_stuff
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号