code: def sequence_softmax(x, beta=None):
      """Compute sequence softmax over paddle LodTensor
  
      This function compute softmax normalization along with the length of sequence.
      This function is an extention of :code:`L.sequence_softmax` which can only
      deal with LodTensor whose last dimension is 1.
  
      Args:
          x: The input variable which is a LodTensor.
          beta: Inverse Temperature
  
      Return:
          Output of sequence_softmax
      """
  
      if beta is not None:
          x = x * beta
  
      x_max = L.sequence_pool(x, "max")
      x_max = L.sequence_expand_as(x_max, x)
      x = x - x_max
      exp_x = L.exp(x)
      sum_exp_x = L.sequence_pool(exp_x, "sum")
      sum_exp_x = L.sequence_expand_as(sum_exp_x, exp_x)
      return exp_x / sum_exp_x
  
file_path: PGL/legacy/pgl/utils/paddle_helper.py
imports: import warnings
  import numpy
  import paddle
  from paddle.fluid import core
  import paddle.fluid
  import paddle.fluid.layer_helper
  import paddle.fluid.layers
  from pgl.utils.logger import log
label_desc: Use image node_id 4 for calling a global function with example usage: sequence_softmax(x, beta) and returns: unknown