class_docstr: PyTorch Lightning callback to prune unpromising trials.
  
  See `the example <https://github.com/optuna/optuna-examples/blob/
  main/pytorch/pytorch_lightning_simple.py>`__
  if you want to add a pruning callback which observes accuracy.
  
  Args:
      trial:
          A :class:`~optuna.trial.Trial` corresponding to the current evaluation of the
          objective function.
      monitor:
          An evaluation metric for pruning, e.g., ``val_loss`` or
          ``val_acc``. The metrics are obtained from the returned dictionaries from e.g.
          ``lightning.pytorch.LightningModule.training_step`` or
          ``lightning.pytorch.LightningModule.validation_epoch_end`` and the names thus depend on
          how this dictionary is formatted.
  
  
  .. note::
      For the distributed data parallel training, the version of PyTorchLightning needs to be
      higher than or equal to v1.6.0. In addition, :class:`~optuna.study.Study` should be
      instantiated with RDB storage.
  
  
  .. note::
      If you would like to use PyTorchLightningPruningCallback in a distributed training
      environment, you need to evoke `PyTorchLightningPruningCallback.check_pruned()`
      manually so that :class:`~optuna.exceptions.TrialPruned` is properly handled.
code: def __init__(self, trial: optuna.trial.Trial, monitor: str) -> None:
      _imports.check()
      super().__init__()
  
      self._trial = trial
      self.monitor = monitor
      self.is_ddp_backend = False
  
file_path: optuna/optuna/integration/pytorch_lightning.py
imports: import warnings
  from packaging import version
  import optuna
  from optuna.storages._cached_storage import _CachedStorage
  from optuna.storages._rdb.storage import RDBStorage
label_desc: Use image node_id 1 to create a new PyTorchLightningPruningCallback object from inherited base classes: Callback with example: obj = PyTorchLightningPruningCallback(trial, monitor)