class_docstr: Extending DDPStrategy to support IPEX and auto_lr on k8s.
docstr: Setup the distributed environment of sub processes, we add ipex optimization here.
docstr_tok: ["Setup","the","distributed","environment","of","sub","processes",",","we","add","ipex","optimization","here","."]
code: def setup(self, trainer: "pl.Trainer") -> None:
      """Setup the distributed environment of sub processes, we add ipex optimization here."""
      invalidInputError(
          self.model is not None, "You must specify the model."
      )
  
      super().setup(trainer)
  
      if trainer.training and self.auto_lr:
  
          def _unpack_lightning_optimizer(opt):
              return (
                  opt._optimizer
                  if isinstance(opt, LightningOptimizer)
                  else opt
              )
  
          optimizers = self.optimizers
          optimizers = [
              _unpack_lightning_optimizer(opt) for opt in optimizers
          ]
  
          for optimizer in optimizers:
              for param_group in optimizer.param_groups:
                  param_group["lr"] *= self.world_size
  
          lr_scheduler_configs = self.lr_scheduler_configs
          for config in lr_scheduler_configs:
              scheduler = config.scheduler
              if isinstance(scheduler, _LRScheduler):
                  scheduler.base_lrs = [  # type: ignore
                      lr * self.world_size for lr in scheduler.base_lrs  # type: ignore
                  ]
  
      if self.use_ipex:
          ipex_optimize(
              self.model,
              optimizers=self.optimizers,
              inplace=True,
              dtype=self.dtype,
          )
  
imports: from pytorch_lightning.strategies import DDPStrategy
  from typing import Any, List, Optional, Union, Dict
  import torch
  import os
  import warnings
  from torch import nn
  from torch.nn.parallel.distributed import DistributedDataParallel
  from torch.optim.lr_scheduler import _LRScheduler
  import pytorch_lightning
  from pytorch_lightning.core.optimizer import LightningOptimizer
  from pytorch_lightning.core.optimizer import _configure_schedulers_automatic_opt
  from pytorch_lightning.core.optimizer import _configure_schedulers_manual_opt
  from pytorch_lightning.core.optimizer import _set_scheduler_opt_idx, _validate_scheduler_api
  from pytorch_lightning.plugins.environments import KubeflowEnvironment
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.utils.pytorch import TORCH_VERSION_LESS_1_12
  from bigdl.nano.deps.ipex.ipex_api import ipex_optimize
label_desc: Use image node_id 2 for calling the DDPK8sStrategy obj's underlying member method code with example usage: obj.setup(trainer) and returns: unknown