class_docstr: Beam search 
class_docstr_tok: ["Beam","search"]
code: def __init__(self, size, device=False):
      self.size = size
      self._done = False
      # The score for each translation on the beam.
      self.scores = paddle.zeros((size,), dtype=paddle.float32)
      self.all_scores = []
      # The backpointers at each time-step.
      self.prev_ks = []
      # The outputs at each time-step.
      self.next_ys = [paddle.full((size,), 0, dtype=paddle.int64)]
      self.next_ys[0][0] = 2
  
imports: import math
  import paddle
  from paddle import nn
  import paddle.nn.functional
  from paddle.nn import LayerList
  from paddle.nn import Dropout, Linear, LayerNorm
  import numpy
  from ppocr.modeling.backbones.rec_svtrnet import Mlp, zeros_, ones_
  from paddle.nn.initializer import XavierNormal
label_desc: Use image node_id 1 to create a new Beam object  with example: obj = Beam(size, device)