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)
| 685 | # This function was copied from: https://github.com/huggingface/accelerate/blob/874c4967d94badd24f893064cc3bef45f57cadf7/src/accelerate/utils/versions.py#L338 |
| 686 | @cache |
| 687 | def 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 |
searching dependent graphs…