code: def _get_length(logit):
      """Greed decoder to obtain length from logit"""
      out = logit.argmax(-1) == 0
      abn = out.any(-1)
      out_int = out.cast("int32")
      out = (out_int.cumsum(-1) == 1) & out
      out = out.cast("int32")
      out = out.argmax(-1)
      out = out + 1
      len_seq = paddle.zeros_like(out) + logit.shape[1]
      out = paddle.where(abn, out, len_seq)
      return out
  
imports: import math
  import paddle
  from paddle import nn
  import paddle.nn.functional
  from paddle.nn import LayerList
  from ppocr.modeling.heads.rec_nrtr_head import TransformerBlock, PositionalEncoding
label_desc: Use image node_id 3 for calling a global function with example usage: _get_length(logit) and returns: out