1# Defined in torch/csrc/monitor/python_init.cpp 2 3import datetime 4from enum import Enum 5from typing import Callable 6 7class Aggregation(Enum): 8 VALUE = ... 9 MEAN = ... 10 COUNT = ... 11 SUM = ... 12 MAX = ... 13 MIN = ... 14 15class Stat: 16 name: str 17 count: int 18 def __init__( 19 self, 20 name: str, 21 aggregations: list[Aggregation], 22 window_size: int, 23 max_samples: int = -1, 24 ) -> None: ... 25 def add(self, v: float) -> None: ... 26 def get(self) -> dict[Aggregation, float]: ... 27 28class Event: 29 name: str 30 timestamp: datetime.datetime 31 data: dict[str, int | float | bool | str] 32 def __init__( 33 self, 34 name: str, 35 timestamp: datetime.datetime, 36 data: dict[str, int | float | bool | str], 37 ) -> None: ... 38 39def log_event(e: Event) -> None: ... 40 41class EventHandlerHandle: ... 42 43def register_event_handler(handler: Callable[[Event], None]) -> EventHandlerHandle: ... 44def unregister_event_handler(handle: EventHandlerHandle) -> None: ... 45