trw.utils.requires

Module Contents

Functions

torch_requires(min_version: str, silent_fail: bool = False)

Requires a minimum pytorch version.

trw.utils.requires.torch_requires(min_version: str, silent_fail: bool = False)

Requires a minimum pytorch version.

If the version is not satisfy, the requested function will throw a RuntimeError when called (but not when declared) if silent_fail is False. Otherwise, the function is not called and None is returned.

Parameters
  • min_version – a version represented as string

  • silent_fail – if True, the decorated function will not be executed and return None. If False, throw a RuntimeError