MCPcopy Create free account
hub / github.com/SooLab/CGFormer / torch_required

Function torch_required

bert/file_utils.py:787–796  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

785
786
787def torch_required(func):
788 # Chose a different decorator name than in tests so it's clear they are not the same.
789 @wraps(func)
790 def wrapper(*args, **kwargs):
791 if is_torch_available():
792 return func(*args, **kwargs)
793 else:
794 raise ImportError(f"Method `{func.__name__}` requires PyTorch.")
795
796 return wrapper
797
798
799def tf_required(func):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected