class_docstr: A wrapper for a chainer RNNLM
  
  :param link.Chain predictor : The RNNLM
  :param function lossfun: The loss function to use
  :param int/str label_key:
class_docstr_tok: ["A","wrapper","for","a","chainer","RNNLM",":","param","link.Chain","predictor",":","The","RNNLM",":","param","function","lossfun",":","The","loss","function","to","use",":","param","int\/str","label_key",":"]
code: def __init__(
      self,
      predictor,
      lossfun=softmax_cross_entropy.softmax_cross_entropy,
      label_key=-1,
  ):
      if not (isinstance(label_key, (int, str))):
          raise TypeError(
              "label_key must be int or str, but is %s"
              % type(label_key)
          )
  
      super(ClassifierWithState, self).__init__()
      self.lossfun = lossfun
      self.y = None
      self.loss = None
      self.label_key = label_key
  
      with self.init_scope():
          self.predictor = predictor
  
imports: import copy
  import json
  import logging
  import chainer
  import chainer.functions
  import chainer.links
  import numpy
  from chainer import link, reporter, training
  from chainer.dataset import convert
  from chainer.functions.loss import softmax_cross_entropy
  from chainer.training import extensions
  import espnet.nets.chainer_backend.deterministic_embed_id
  from espnet.lm.lm_utils import MakeSymlinkToBestModel, ParallelSentenceIterator, compute_perplexity, count_tokens, read_tokens
  from espnet.nets.lm_interface import LMInterface
  from espnet.optimizer.factory import dynamic_import_optimizer
  from espnet.scheduler.chainer import ChainerScheduler
  from espnet.scheduler.scheduler import dynamic_import_scheduler
  from espnet.utils.deterministic_utils import set_deterministic_chainer
  from espnet.utils.training.evaluator import BaseEvaluator
  from espnet.utils.training.iterators import ShufflingEnabler
  from espnet.utils.training.tensorboard_logger import TensorboardLogger
  from espnet.utils.training.train_utils import check_early_stop, set_early_stop
label_desc: Use image node_id 1 to create a new ClassifierWithState object from inherited base classes: link with example: obj = ClassifierWithState(predictor, lossfun, label_key)