class_docstr: Run beam decoding based on the beam search output from
  DecoderBatchedStepEnsemble2BeamWithEOS. The differences compared with BeamDecode is:
  1.there's no need to check prev_hypos finished or not when trying to get all end
  states since we don't expand at eos token in DecoderBatchedStepEnsemble2BeamWithEOS.
  2. add extra step for eos token at the end.
class_docstr_tok: ["Run","beam","decoding","based","on","the","beam","search","output","from","DecoderBatchedStepEnsemble2BeamWithEOS",".","The","differences","compared","with","BeamDecode","is",":","1.there","'s","no","need","to","check","prev_hypos","finished","or","not","when","trying","to","get","all","end","states","since","we","do","n't","expand","at","eos","token","in","DecoderBatchedStepEnsemble2BeamWithEOS",".","2.","add","extra","step","for","eos","token","at","the","end","."]
code: def _check_dimensions(
      self,
      beam_tokens: Tensor,
      beam_scores: Tensor,
      token_weights: Tensor,
      beam_prev_indices: Tensor,
      num_steps: int,
  ) -> None:
      assert (
          beam_tokens.size(1) == 2 * self.beam_size
      ), "Dimension of beam_tokens : {} and beam size : {} are not consistent".format(
          beam_tokens.size(), self.beam_size
      )
      assert beam_scores.size(1) == 2 * self.beam_size, (
          "Dimension of beam_scores : {} and beam size : {} "
          "are not consistent".format(
              beam_scores.size(), self.beam_size
          )
      )
      assert token_weights.size(1) == 2 * self.beam_size, (
          "Dimension of token_weights : {} and beam size : {} "
          "are not consistent".format(
              token_weights.size(), self.beam_size
          )
      )
      assert (
          beam_prev_indices.size(1) == 2 * self.beam_size
      ), "Dimension of beam_prev_indices : {} and beam size : {} "
      "are not consistent".format(
          beam_prev_indices.size(), self.beam_size
      )
  
      assert beam_tokens.size(0) <= num_steps + 2, (
          "Dimension of beam_tokens : {} and num_steps : {} "
          "are not consistent".format(beam_tokens.size(), num_steps)
      )
      assert beam_scores.size(0) <= num_steps + 2, (
          "Dimension of beam_scores : {} and num_steps : {} "
          "are not consistent".format(beam_scores.size(), num_steps)
      )
      assert token_weights.size(0) <= num_steps + 2, (
          "Dimension of token_weights : {} and num_steps : {} "
          "are not consistent".format(token_weights.size(), num_steps)
      )
      assert beam_prev_indices.size(0) <= num_steps + 2, (
          "Dimension of beam_prev_indices : {} and num_steps : {} "
          "are not consistent".format(
              beam_prev_indices.size(), num_steps
          )
      )
  
imports: from typing import List, Tuple
  import numpy
  import torch
  import torch.jit
  import torch.jit.quantized
  from pytorch_translate.beam_decode import BeamDecode
  from pytorch_translate.ensemble_export import DecoderBatchedStepEnsemble, EncoderEnsemble, FakeCharSourceEncoderEnsemble, load_models_from_checkpoints
  from torch import Tensor
label_desc: Use image node_id 2 for calling the BeamDecodeWithEOS obj's underlying member method code with example usage: obj._check_dimensions(beam_tokens, beam_scores, token_weights, beam_prev_indices, num_steps) without return types