code: def reduce_sum_over_lc(x, x_mask):
      """Returns sum of x (over L and C) given the actual length and pad.
  
      Args:
        x: input. (B,L,C)
        x_mask: binary padding mask. (B,L)
  
      Returns:
        sum of x. (B)
      """
  
      if x.shape.rank == 3 and x_mask.shape.rank == 2:
          x_mask = x_mask[..., tf.newaxis]
      else:
          tf.logging.info(
              "x: {}, x_mask: {}".format(
                  x.shape.rank, x_mask.shape.rank
              )
          )
          raise ValueError("Dimension not supported.")
  
      mean = x * x_mask
      return tf.reduce_sum(mean, axis=[1, 2])
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import math
  from tensor2tensor.layers import common_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.models.transformer import transformer_decoder_layer
  import tensorflow.compat.v1
  import tensorflow_probability
label_desc: Use image node_id 4 for calling a global function with example usage: reduce_sum_over_lc(x, x_mask) and returns: tf