Source code for monitorch.preprocessor.abstract.abstract_preprocessor
from abc import ABC, abstractmethod
from typing import Any
[docs]
class AbstractPreprocessor(ABC):
"""
Base class for all preprocessors.
"""
@property
@abstractmethod
def value(self) -> dict[str, Any]:
"""
Value computed by preprocessor for all layers, that it is processing, identified by name.
Returns
-------
dict[str, Any]
Result of computations done from creation of preprocessor or last reset.
"""
pass
[docs]
@abstractmethod
def start_sync(self, dst_rank: int = 0) -> None:
"""
Start synchronization of the data with the dst_rank.
Parameters
-------
dst_rank : int = 0
Master rank to gather data at.
"""
pass
[docs]
@abstractmethod
def finish_sync(self) -> None:
"""
Start synchronization of the data with the dst_rank.
Parameters
-------
dst_rank : int = 0
Master rank to gather data at.
"""
pass
[docs]
@abstractmethod
def reset(self) -> None:
"""Resets preprocessor for further computation"""
pass