Shortcuts

torch_version_ge

torchtune.utils.torch_version_ge(version: str) bool[source]

检查torch版本是否大于或等于给定版本。

Parameters:

版本 (str) – 要比较的torch版本

Returns:

如果torch版本大于或等于给定版本,则为True。

Return type:

bool

示例

>>> print(torch.__version__)
2.4.0
>>> torch_version_ge("2.0")
True