-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
Currently, they are booleans but we could extend them to Union[bool, Callable] where if arg is callable then it could be used for event filtering:
def attach(self, engine):
if self.iteration_log and not engine.has_event_handler(self.iteration_completed, Events.ITERATION_COMPLETED):
event_filter = self.iteration_log if callable(self.iteration_log) else None
engine.add_event_handler(
Events.ITERATION_COMPLETED(event_filter=event_filter), self.iteration_completed
)
if self.epoch_log and not engine.has_event_handler(self.epoch_completed, Events.EPOCH_COMPLETED):
event_filter = self.epoch_log if callable(self.epoch_log) else None
engine.add_event_handler(
Events.EPOCH_COMPLETED(event_filter=event_filter), self.epoch_completed
) Originally posted by @vfdev-5 in #5958 (reply in thread)
Nic-Ma