MCPcopy Index your code
hub / github.com/huggingface/diffusers / is_torch_version

Function is_torch_version

src/diffusers/utils/import_utils.py:687–697  ·  view source on GitHub ↗

Compares the current PyTorch version to a given reference with an operation. Args: operation (`str`): A string representation of an operator, such as `">"` or `"<="` version (`str`): A string version of PyTorch

(operation: str, version: str)

Source from the content-addressed store, hash-verified

685# This function was copied from: https://github.com/huggingface/accelerate/blob/874c4967d94badd24f893064cc3bef45f57cadf7/src/accelerate/utils/versions.py#L338
686@cache
687def is_torch_version(operation: str, version: str):
688 """
689 Compares the current PyTorch version to a given reference with an operation.
690
691 Args:
692 operation (`str`):
693 A string representation of an operator, such as `">"` or `"<="`
694 version (`str`):
695 A string version of PyTorch
696 """
697 return compare_versions(parse(_torch_version), operation, version)
698
699
700@cache

Callers 15

require_torch_2Function · 0.90
decoratorFunction · 0.90
enable_full_determinismFunction · 0.90
encodeMethod · 0.90
is_compiled_moduleFunction · 0.85
outer_wrapperFunction · 0.85
__init_subclass__Method · 0.85
require_torch_2Function · 0.85
decoratorFunction · 0.85
from_pretrainedMethod · 0.85
__call__Method · 0.85

Calls 1

compare_versionsFunction · 0.85

Tested by 6

require_torch_2Function · 0.72
decoratorFunction · 0.72
enable_full_determinismFunction · 0.72
require_torch_2Function · 0.68
decoratorFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…