class_docstr: Monitor a metric and stop training when it stops improving.
  
  Args:
      monitor: quantity to be monitored.
      min_delta: minimum change in the monitored quantity to qualify as an improvement, i.e. an absolute
          change of less than or equal to `min_delta`, will count as no improvement.
      patience: number of checks with no improvement
          after which training will be stopped. Under the default configuration, one check happens after
          every training epoch. However, the frequency of validation can be modified by setting various parameters on
          the ``Trainer``, for example ``check_val_every_n_epoch`` and ``val_check_interval``.
  
          .. note::
  
              It must be noted that the patience parameter counts the number of validation checks with
              no improvement, and not the number of training epochs. Therefore, with parameters
              ``check_val_every_n_epoch=10`` and ``patience=3``, the trainer will perform at least 40 training
              epochs before being stopped.
  
      verbose: verbosity mode.
      mode: one of ``'min'``, ``'max'``. In ``'min'`` mode, training will stop when the quantity
          monitored has stopped decreasing and in ``'max'`` mode it will stop when the quantity
          monitored has stopped increasing.
      strict: whether to crash the training if `monitor` is not found in the validation metrics.
      check_finite: When set ``True``, stops training when the monitor becomes NaN or infinite.
      stopping_threshold: Stop training immediately once the monitored quantity reaches this threshold.
      divergence_threshold: Stop training as soon as the monitored quantity becomes worse than this threshold.
      check_on_train_epoch_end: whether to run early stopping at the end of the training epoch.
          If this is ``False``, then the check runs at the end of the validation.
      log_rank_zero_only: When set ``True``, logs the status of the early stopping callback only for rank 0 process.
  
  Raises:
      MisconfigurationException:
          If ``mode`` is none of ``"min"`` or ``"max"``.
      RuntimeError:
          If the metric ``monitor`` is not available.
  
  Example::
  
      >>> from lightning.pytorch import Trainer
      >>> from lightning.pytorch.callbacks import EarlyStopping
      >>> early_stopping = EarlyStopping('val_loss')
      >>> trainer = Trainer(callbacks=[early_stopping])
  
  .. tip:: Saving and restoring multiple early stopping callbacks at the same time is supported under variation in the
      following arguments:
  
      *monitor, mode*
  
      Read more: :ref:`Persisting Callback State <extensions/callbacks_state:save callback state>`
code: def _should_skip_check(self, trainer: "pl.Trainer") -> bool:
      from lightning.pytorch.trainer.states import TrainerFn
  
      return (
          trainer.state.fn != TrainerFn.FITTING
          or trainer.sanity_checking
      )
  
imports: import logging
  from typing import Any, Callable, Dict, Optional, Tuple
  import torch
  from torch import Tensor
  from typing_extensions import override
  import lightning.pytorch
  from lightning.pytorch.callbacks.callback import Callback
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.rank_zero import rank_prefixed_message, rank_zero_warn
label_desc: Use image node_id 8 for calling the EarlyStopping obj's underlying member method code with example usage: obj._should_skip_check(trainer) and returns: unknown