torch_ecg.utils.timeout

torch_ecg.utils.timeout(duration: float)[source]

A context manager that raises a TimeoutError after a specified time.

Modified from 1.

Parameters

duration (float) – The time duration in seconds, should be non-negative, 0 for no timeout.

References

1

https://stackoverflow.com/questions/492519/timeout-on-a-function-call