class_docstr: Shared RNN model.
class_docstr_tok: ["Shared","RNN","model","."]
code: def __init__(self, args, corpus):
      models.shared_base.SharedModel.__init__(self)
  
      self.args = args
      self.corpus = corpus
  
      self.decoder = nn.Linear(args.shared_hid, corpus.num_tokens)
      self.encoder = EmbeddingDropout(
          corpus.num_tokens,
          args.shared_embed,
          dropout=args.shared_dropoute,
      )
      self.lockdrop = LockedDropout()
  
      if self.args.tie_weights:
          self.decoder.weight = self.encoder.weight
  
      # NOTE(brendan): Since W^{x, c} and W^{h, c} are always summed, there
      # is no point duplicating their bias offset parameter. Likewise for
      # W^{x, h} and W^{h, h}.
      self.w_xc = nn.Linear(args.shared_embed, args.shared_hid)
      self.w_xh = nn.Linear(args.shared_embed, args.shared_hid)
  
      # The raw weights are stored here because the hidden-to-hidden weights
      # are weight dropped on the forward pass.
      self.w_hc_raw = torch.nn.Parameter(
          torch.Tensor(args.shared_hid, args.shared_hid)
      )
      self.w_hh_raw = torch.nn.Parameter(
          torch.Tensor(args.shared_hid, args.shared_hid)
      )
      self.w_hc = None
      self.w_hh = None
  
      self.w_h = collections.defaultdict(dict)
      self.w_c = collections.defaultdict(dict)
  
      for idx in range(args.num_blocks):
          for jdx in range(idx + 1, args.num_blocks):
              self.w_h[idx][jdx] = nn.Linear(
                  args.shared_hid, args.shared_hid, bias=False
              )
              self.w_c[idx][jdx] = nn.Linear(
                  args.shared_hid, args.shared_hid, bias=False
              )
  
      self._w_h = nn.ModuleList(
          [
              self.w_h[idx][jdx]
              for idx in self.w_h
              for jdx in self.w_h[idx]
          ]
      )
      self._w_c = nn.ModuleList(
          [
              self.w_c[idx][jdx]
              for idx in self.w_c
              for jdx in self.w_c[idx]
          ]
      )
  
      if args.mode == "train":
          self.batch_norm = nn.BatchNorm1d(args.shared_hid)
      else:
          self.batch_norm = None
  
      self.reset_parameters()
      self.static_init_hidden = utils.keydefaultdict(self.init_hidden)
  
      logger.info(
          f'# of parameters: {format(self.num_parameters, ",d")}'
      )
  
imports: import numpy
  import collections
  import torch
  from torch import nn
  import torch.nn.functional
  from torch.autograd import Variable
  import models.shared_base
  import utils
label_desc: Use image node_id 1 to create a new RNN object from inherited base classes: models.shared_base with example: obj = RNN(args, corpus)