class_docstr: The difference between BeamSearchAndDecodeV2 and BeamSearchAndDecode is: V2 calls
  DecoderBatchedStepEnsemble2BeamWithEOS instead of DecoderBatchedStepEnsemble when
  running beam search. Also, since extra EOS token has been added, it calls
  BeamDecodeWithEOS when running beam decoding which supports adding extra EOS token.
class_docstr_tok: ["The","difference","between","BeamSearchAndDecodeV2","and","BeamSearchAndDecode","is",":","V2","calls","DecoderBatchedStepEnsemble2BeamWithEOS","instead","of","DecoderBatchedStepEnsemble","when","running","beam","search",".","Also",",","since","extra","EOS","token","has","been","added",",","it","calls","BeamDecodeWithEOS","when","running","beam","decoding","which","supports","adding","extra","EOS","token","."]
code: def save_to_pytorch(self, output_path):
      def pack(s):
          if hasattr(s, "_pack"):
              s._pack()
  
      def unpack(s):
          if hasattr(s, "_unpack"):
              s._unpack()
  
      self.apply(pack)
      torch.jit.save(self, output_path)
      self.apply(unpack)
  
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 4 for calling the BeamSearchAndDecodeV2 obj's underlying member method code with example usage: obj.save_to_pytorch(output_path) without return types