class_docstr: Base class to be inherited by all decoding strategies. Contains
  implementations that are common for all strategies.
  
  Args:
      vocab (list): Collection of all words in vocabulary.
class_docstr_tok: ["Base","class","to","be","inherited","by","all","decoding","strategies",".","Contains","implementations","that","are","common","for","all","strategies",".","Args",":","vocab","(","list",")",":","Collection","of","all","words","in","vocabulary","."]
code: def init_batch(self, sample_list):
      img_size = sample_list.image_feature_0.size()
      self._batch_size, feature_size_1, feature_size_2 = img_size
      t_batch_size = self._batch_size * self._decode_size
      self.seqs = sample_list.answers.new_full(
          (t_batch_size, 1), self._vocab.SOS_INDEX, dtype=torch.long
      )
      sample_list.image_feature_0 = (
          sample_list.image_feature_0.unsqueeze(1)
          .expand(-1, self._decode_size, -1, -1)
          .reshape(t_batch_size, feature_size_1, feature_size_2)
      )
      self.sample_list = sample_list
      return sample_list
  
imports: import os
  import re
  from collections import Counter
  from itertools import chain
  import torch
  from mmf.common.registry import registry
  from mmf.utils.file_io import PathManager
  from mmf.utils.general import get_absolute_path
label_desc: Use image node_id 2 for calling the TextDecoder obj's underlying member method code with example usage: obj.init_batch(sample_list) and returns: sample_list