class_docstr: Bi-LSTM over characters to produce a word embedding from characters
class_docstr_tok: ["Bi-LSTM","over","characters","to","produce","a","word","embedding","from","characters"]
code: def __init__(
      self,
      dictionary,
      num_chars,
      char_embed_dim,
      char_rnn_units,
      char_rnn_layers,
  ):
      super().__init__()
      self.num_chars = num_chars
      self.padding_idx = dictionary.pad()
      self.embed_chars = rnn.Embedding(
          num_embeddings=num_chars,
          embedding_dim=char_embed_dim,
          padding_idx=self.padding_idx,
          freeze_embed=False,
      )
  
      assert (
          char_rnn_units % 2 == 0
      ), "char_rnn_units must be even (to be divided evenly between directions)"
      self.char_lstm_encoder = rnn.LSTMSequenceEncoder.LSTM(
          char_embed_dim,
          char_rnn_units // 2,
          num_layers=char_rnn_layers,
          bidirectional=True,
      )
  
      self.onnx_export_model = False
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from pytorch_translate import common_layers, rnn, utils
  from pytorch_translate.data.dictionary import TAGS
  from torch.nn.utils.rnn import pack_padded_sequence
label_desc: Use image node_id 1 to create a new CharRNNModel object from inherited base classes: nn with example: obj = CharRNNModel(dictionary, num_chars, char_embed_dim, char_rnn_units, char_rnn_layers)