class_docstr: A controller that mutates the graph with RL.
  
  Parameters
  ----------
  fields : list of ReinforceField
      List of fields to choose.
  lstm_size : int
      Controller LSTM hidden units.
  lstm_num_layers : int
      Number of layers for stacked LSTM.
  tanh_constant : float
      Logits will be equal to ``tanh_constant * tanh(logits)``. Don't use ``tanh`` if this value is ``None``.
  skip_target : float
      Target probability that skipconnect will appear.
  temperature : float
      Temperature constant that divides the logits.
  entropy_reduction : str
      Can be one of ``sum`` and ``mean``. How the entropy of multi-input-choice is reduced.
class_docstr_tok: ["A","controller","that","mutates","the","graph","with","RL",".","Parameters","--","--","--","--","--","fields",":","list","of","ReinforceField","List","of","fields","to","choose",".","lstm_size",":","int","Controller","LSTM","hidden","units",".","lstm_num_layers",":","int","Number","of","layers","for","stacked","LSTM",".","tanh_constant",":","float","Logits","will","be","equal","to","``","tanh_constant","*","tanh","(","logits",")","``",".","Do","n't","use","``","tanh","``","if","this","value","is","``","None","``",".","skip_target",":","float","Target","probability","that","skipconnect","will","appear",".","temperature",":","float","Temperature","constant","that","divides","the","logits",".","entropy_reduction",":","str","Can","be","one","of","``","sum","``","and","``","mean","``",".","How","the","entropy","of","multi-input-choice","is","reduced","."]
code: def __init__(
      self,
      fields,
      lstm_size=64,
      lstm_num_layers=1,
      tanh_constant=1.5,
      skip_target=0.4,
      temperature=None,
      entropy_reduction="sum",
  ):
      super(ReinforceController, self).__init__()
      self.fields = fields
      self.lstm_size = lstm_size
      self.lstm_num_layers = lstm_num_layers
      self.tanh_constant = tanh_constant
      self.temperature = temperature
      self.skip_target = skip_target
  
      self.lstm = StackedLSTMCell(
          self.lstm_num_layers, self.lstm_size, False
      )
      self.attn_anchor = nn.Linear(
          self.lstm_size, self.lstm_size, bias=False
      )
      self.attn_query = nn.Linear(
          self.lstm_size, self.lstm_size, bias=False
      )
      self.v_attn = nn.Linear(self.lstm_size, 1, bias=False)
      self.g_emb = nn.Parameter(torch.randn(1, self.lstm_size) * 0.1)
      self.skip_targets = nn.Parameter(
          torch.tensor(
              [1.0 - self.skip_target, self.skip_target]
          ),  # pylint: disable=not-callable
          requires_grad=False,
      )
      assert entropy_reduction in [
          "sum",
          "mean",
      ], "Entropy reduction must be one of sum and mean."
      self.entropy_reduction = (
          torch.sum if entropy_reduction == "sum" else torch.mean
      )
      self.cross_entropy_loss = nn.CrossEntropyLoss(reduction="none")
      self.soft = nn.ModuleDict(
          {
              field.name: nn.Linear(
                  self.lstm_size, field.total, bias=False
              )
              for field in fields
          }
      )
      self.embedding = nn.ModuleDict(
          {
              field.name: nn.Embedding(field.total, self.lstm_size)
              for field in fields
          }
      )
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from .None import register_nas_algo
  from .base import BaseNAS
  from ..space import BaseSpace
  from ..utils import AverageMeterGroup, replace_layer_choice, replace_input_choice, get_module_order, sort_replaced_module, PathSamplingInputChoice, PathSamplingLayerChoice
  from nni.nas.pytorch.fixed import apply_fixed_architecture
  from tqdm import tqdm
  from datetime import datetime
  import numpy
  from ....utils import get_logger
label_desc: Use image node_id 1 to create a new ReinforceController object from inherited base classes: nn with example: obj = ReinforceController(fields, lstm_size, lstm_num_layers, tanh_constant, skip_target, temperature, entropy_reduction)