class_docstr: Sampling-based super-net training but using an RL agent to control the sampling.
  
  The default implementation for :class:`~nni.nas.strategy.ENAS`.
  
  See Also
  --------
  nni.nas.strategy.ENAS
  RandomSamplingLightningModule
code: def __init__(
      self,
      training_module: pl.LightningModule,
      *,
      batches_per_update: float = 20,
      log_prob_every_n_step: int = 10,
      replay_buffer_size: int | None = None,
      reward_metric_name: str | None = None,
      policy_fn: PolicyFactory | None = None,
      update_kwargs: dict | None = None,
      warmup_epochs: int = 0,
      penalty: ProfilerPenalty | None = None,
  ):
      super().__init__(training_module)
  
      if not has_tianshou:
          raise ImportError("ENAS requires tianshou to be installed.")
  
      if reward_metric_name is None:
          _logger.warning(
              "It is strongly recommended to have `reward_metric_name` specified. "
              "It should be one of the metrics logged in `self.log` in evaluator. "
              "Otherwise it will infer the reward based on certain rules."
          )
  
      self.batches_per_update = batches_per_update
      self.replay_buffer_size = replay_buffer_size
      self.log_prob_every_n_step = log_prob_every_n_step
      self.reward_metric_name = reward_metric_name
  
      self.policy_fn = policy_fn
      self.update_kwargs = update_kwargs or {}
      self.warmup_epochs = warmup_epochs
  
      self.penalty = penalty
  
      self._policy: BasePolicy | None = None
      self._generator: TuningTrajectoryGenerator | None = None
      self._replay_buffer: ReplayBuffer | None = None
      self._trajectory_counter: int = 0
  
imports: from __future__ import annotations
  import warnings
  import logging
  from typing import Any, Callable, TYPE_CHECKING
  import pytorch_lightning
  import torch
  from nni.mutable import Sample
  from nni.nas.nn.pytorch import ModelSpace
  from .base_lightning import BaseOneShotLightningModule
  from .profiler import ProfilerPenalty, ExpectationProfilerPenalty, SampleProfilerPenalty
label_desc: Use image node_id 1 to create a new EnasLightningModule object from inherited base classes: BaseOneShotLightningModule with example: obj = EnasLightningModule(training_module)