class_docstr: A decoder that is similar to the HybridRNNDecoder but has a character
  CNN encoder to get the representation for each generated previous token.
  The decoder is similar to https://arxiv.org/pdf/1809.02223.pdf.
class_docstr_tok: ["A","decoder","that","is","similar","to","the","HybridRNNDecoder","but","has","a","character","CNN","encoder","to","get","the","representation","for","each","generated","previous","token",".","The","decoder","is","similar","to","https",":","\/\/arxiv.org\/pdf\/1809.02223.pdf","."]
docstr: Precomputes the embeddings from character CNNs. Then adds that to the
  word embeddings.
  Args:
      batch_size: maximum number of words in one batch
docstr_tok: ["Precomputes","the","embeddings","from","character","CNNs",".","Then","adds","that","to","the","word","embeddings",".","Args",":","batch_size",":","maximum","number","of","words","in","one","batch"]
code: def precompute_char_representations(
      self, char_dict, embed_bytes=False, batch_size=5000
  ):
      """
      Precomputes the embeddings from character CNNs. Then adds that to the
      word embeddings.
      Args:
          batch_size: maximum number of words in one batch
      """
      character_list = self._char_list_from_dict(
          char_dict=char_dict, embed_bytes=embed_bytes
      )
      all_idx = maybe_cuda(
          torch.LongTensor(
              [i for i in range(self.embed_tokens.num_embeddings)]
          )
      )
      word_embeds = self.embed_tokens(all_idx)
      num_minibatches = math.ceil(len(character_list) / batch_size)
      for i in range(num_minibatches):
          character_sublist = character_list[
              i
              * batch_size : min(
                  (i + 1) * batch_size, len(character_list)
              )
          ]
          max_word_len = max(len(chars) for chars in character_sublist)
          char_inds = (
              torch.Tensor(len(character_sublist), max_word_len)
              .long()
              .fill_(char_dict.pad_index)
          )
  
          for j, chars in enumerate(character_sublist):
              char_inds[j, : len(chars)] = torch.LongTensor(chars)
  
          char_cnn_output = self._get_char_cnn_output(
              maybe_cuda(char_inds)
          )
  
          # Filling in the precomputed embedding values.
          index_offset = i * batch_size
          for j in range(char_cnn_output.size()[1]):
              cur_idx = j + index_offset
              self.combined_word_char_embed.weight[cur_idx] = (
                  char_cnn_output[0, j, :] + word_embeds[cur_idx]
              )
  
      self._is_precomputed = True
      self.combined_word_char_embed.weight.detach()
  
imports: import math
  from ast import literal_eval
  from typing import List
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq.models import register_model, register_model_architecture
  from pytorch_translate import char_encoder, char_source_hybrid, char_source_model, hybrid_transformer_rnn, transformer, vocab_constants
  from pytorch_translate.data.dictionary import TAGS
  from pytorch_translate.utils import maybe_cuda
label_desc: Use image node_id 6 for calling the CharAwareHybridRNNDecoder obj's underlying member method code with example usage: obj.precompute_char_representations(char_dict, embed_bytes, batch_size) without return types