• 文档 >
  • 模块代码 >
  • torch >
  • torch.backends.cusparselt
快捷键

torch.backends.cusparselt 的源代码

# mypy: 允许未类型化定义
来自 打字 导入 可选

导入 火炬


全部 = [
    版本,
    "是否可用",
    "获取最大算法 ID",
]

尝试:
    来自 torch._C 导入 cusparselt
除了 导入错误:
    cusparselt =   # 类型:忽略[赋值]

__cusparselt 版本: 可选[int] = 
__MAX_ALG_ID: 可选[int] = 

如果 _cusparselt   :

    def _初始化():
        全局 __cusparselt_version
        全局 __MAX_ALG_ID
        如果 __cusparselt 版本  :
            __cusparselt 版本 = _cusparselt.获取版本整数()
            如果 __cusparselt 版本 == 400:
                __最大算法 ID = 4
            如果...否则 __cusparselt 版本 == 502:
                __最大算法 ID = 5
            如果...否则 __cusparselt 版本 == 602:
                __MAX_ALG_ID = 37
        返回 真实

否则:

    def _初始化():
        返回 


[文档]def 版本() -> Optional[int]: """返回 cuSPARSELt 的版本""" 如果没有 _init() 返回 None 返回 __cusparselt_version
[文档]def is_available() -> bool: 返回一个布尔值,指示 cuSPARSELt 当前是否可用。 返回 torch._C._has_cusparselt
def 获取最大算法 ID
() -> 可选[int] 如果 _初始化(): 返回 返回 __MAX_ALG_ID

© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,并使用 Read the Docs 提供的主题。

文档

查看 PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源,获取您的疑问解答

查看资源