"""Custom decorators for test coverage management."""importosfromtypingimportCallable,Optional
[docs]deftorch_compile(model:Optional[Callable]=None,**kwargs)->Callable:# pragma: no cover""" Custom decorator similar to :py:func:`torch.compile`. However the compilation of the function will not be performed if the ``DISABLE_TORCH_COMPILE`` environment variable is set. Arguments: model: Module/function to optimize. *args: Arguments for :py:func:`torch.compile`. **kwargs: Keyword arguments for :py:func:`torch.compile`. Returns: Decorated model. """ifos.environ.get("DISABLE_TORCH_COMPILE"):returnlambdax:x# Identity functionimporttorch# We want to import only if we are not using eagerreturntorch.compile(model,**kwargs)