code: def reformat_samples(seq2seq_obj, num_beams, batch_size):
      samples = [
          [seq2seq_obj.candidates[bb][:, ex] for bb in range(num_beams)]
          for ex in range(batch_size)
      ]
      examples = []
      for ex in range(batch_size):
          examples.append(
              np.vstack([samples[ex][ii] for ii in range(num_beams)])
          )
      return examples
  
file_path: neon/tests/test_beamsearch.py
imports: from neon.backends import gen_backend
  from neon.initializers.initializer import Array
  from neon.layers.recurrent import LSTM
  from neon.layers.container import Seq2Seq
  from neon.transforms import Tanh, Logistic
  import numpy
  from neon import NervanaObject
  from neon.util.beamsearch import BeamSearch
  from utils import allclose_with_out
label_desc: Use image node_id 1 for calling a global function with example usage: reformat_samples(seq2seq_obj, num_beams, batch_size) and returns: examples