Home / Function/ exit_after() — pytorch Function Reference

exit_after() — pytorch Function Reference

Architecture documentation for the exit_after() function in common.py from the pytorch codebase.

Entity Profile

Relationship Graph

Source Code

benchmarks/dynamo/common.py lines 1646–1664

def exit_after(s):
    """
    Decorator to raise TimeoutException if the fn is taking more than s seconds
    to run.
    """

    def outer(fn):
        def inner(*args, **kwargs):
            signal.signal(signal.SIGALRM, alarm_handler)
            signal.alarm(s)
            try:
                result = fn(*args, **kwargs)
            finally:
                signal.alarm(0)
            return result

        return inner

    return outer

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free