pytorch
1# mypy: allow-untyped-defs
2from abc import ABC, abstractmethod3
4
5class _StreamBase(ABC):6r"""Base stream class abstraction for multi backends Stream to herit from"""7
8@abstractmethod9def wait_event(self, event) -> None:10raise NotImplementedError11
12@abstractmethod13def wait_stream(self, stream) -> None:14raise NotImplementedError15
16@abstractmethod17def record_event(self, event=None) -> None:18raise NotImplementedError19
20@abstractmethod21def query(self) -> bool:22raise NotImplementedError23
24@abstractmethod25def synchronize(self) -> None:26raise NotImplementedError27
28@abstractmethod29def __eq__(self, stream) -> bool:30raise NotImplementedError31
32
33class _EventBase(ABC):34r"""Base Event class abstraction for multi backends Event to herit from"""35
36@abstractmethod37def wait(self, stream=None) -> None:38raise NotImplementedError39
40@abstractmethod41def query(self) -> bool:42raise NotImplementedError43
44@abstractmethod45def synchronize(self) -> None:46raise NotImplementedError47