code: def running_global_pool_1d(inputs, pooling_type="MAX"):
    
    del pooling_type
    with tf.name_scope("running_global_pool", values=[inputs]):
      scan_fct = tf.maximum
      # Permute inputs so seq_length is first.
      elems = tf.transpose(inputs, [1, 0, 2])
      # Perform scan.
      cumulatives = tf.scan(scan_fct, elems, swap_memory=True)
      # Permute output to get back to original order.
      output = tf.transpose(cumulatives, [1, 0, 2])
    return output
docs: Same global pool, but only for the elements up to the current element.
  
    Useful for outputs where the state of future elements is not known.
    Takes no mask as all elements up to the current element are assumed to exist.
    Currently only supports maximum. Equivalent to using a lower triangle bias.
  
    Args:
      inputs: A tensor of shape [batch_size, sequence_length, input_dims]
        containing the sequences of input vectors.
      pooling_type: Pooling type to use. Currently only supports 'MAX'.
  
    Returns:
      A tensor of shape [batch_size, sequence_length, input_dims] containing the
      running 'totals'.