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 _sample_single(self, field):
      self._lstm_next_step()
      logit = self.soft[field.name](self._h[-1])
      if self.temperature is not None:
          logit /= self.temperature
      if self.tanh_constant is not None:
          logit = self.tanh_constant * torch.tanh(logit)
      if field.choose_one:
          sampled = torch.multinomial(F.softmax(logit, dim=-1), 1).view(
              -1
          )
          log_prob = self.cross_entropy_loss(logit, sampled)
          self._inputs = self.embedding[field.name](sampled)
      else:
          logit = logit.view(-1, 1)
          logit = torch.cat(
              [-logit, logit], 1
          )  # pylint: disable=invalid-unary-operand-type
          sampled = torch.multinomial(F.softmax(logit, dim=-1), 1).view(
              -1
          )
          skip_prob = torch.sigmoid(logit)
          kl = torch.sum(
              skip_prob * torch.log(skip_prob / self.skip_targets)
          )
          self.sample_skip_penalty += kl
          log_prob = self.cross_entropy_loss(logit, sampled)
          sampled = sampled.nonzero().view(-1)
          if sampled.sum().item():
              self._inputs = (
                  torch.sum(
                      self.embedding[field.name](sampled.view(-1)), 0
                  )
                  / (1.0 + torch.sum(sampled))
              ).unsqueeze(0)
          else:
              self._inputs = torch.zeros(
                  1,
                  self.lstm_size,
                  device=self.embedding[field.name].weight.device,
              )
  
      sampled = sampled.detach().numpy().tolist()
      self.sample_log_prob += self.entropy_reduction(log_prob)
      entropy = (
          log_prob * torch.exp(-log_prob)
      ).detach()  # pylint: disable=invalid-unary-operand-type
      self.sample_entropy += self.entropy_reduction(entropy)
      if len(sampled) == 1:
          sampled = sampled[0]
      return sampled
  
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 5 for calling the ReinforceController obj's underlying member method code with example usage: obj._sample_single(field) and returns: sampled