def __init__(self, monitor: str='val_loss', min_delta: float=0.0, patience: int=3, verbose: bool=False, mode: str='auto', strict: bool=True):
    super().__init__()
    self.monitor = monitor
    self.patience = patience
    self.verbose = verbose
    self.strict = strict
    self.min_delta = min_delta
    self.wait_count = 0
    self.stopped_epoch = 0
    self.mode = mode
    if (mode not in self.mode_dict):
        if (self.verbose > 0):
            log.info(f'EarlyStopping mode {mode} is unknown, fallback to auto mode.')
        self.mode = 'auto'
    if (self.mode == 'auto'):
        if (self.monitor == 'acc'):
            self.mode = 'max'
        else:
            self.mode = 'min'
        if (self.verbose > 0):
            log.info(f'EarlyStopping mode set to {self.mode} for monitoring {self.monitor}.')
    self.min_delta *= (1 if (self.monitor_op == torch.gt) else (- 1))
    self.best_score = (torch_inf if (self.monitor_op == torch.lt) else (- torch_inf))
def __init__(self, monitor: str='val_loss', min_delta: float=0.0, patience: int=3, verbose: bool=False, mode: str='auto', strict: bool=True):
    super().__init__()
    self.monitor = monitor
    self.patience = patience
    self.verbose = verbose
    self.strict = strict
    self.min_delta = min_delta
    self.wait_count = 0
    self.stopped_epoch = 0
    self.mode = mode
    if (mode not in self.mode_dict):
        if (self.verbose > 0):
            log.info(f'EarlyStopping mode {mode} is unknown, fallback to auto mode.')
        self.mode = 'auto'
    if (self.mode == 'auto'):
        if (self.monitor == 'acc'):
            self.mode = 'max'
        else:
            self.mode = 'min'
        if (self.verbose > 0):
            log.info(f'EarlyStopping mode set to {self.mode} for monitoring {self.monitor}.')
    self.min_delta *= (1 if (self.monitor_op == torch.gt) else (- 1))
    self.best_score = (torch_inf if (self.monitor_op == torch.lt) else (- torch_inf))