code: def compute_sen_lens(inputs, padding_token=0):
      """
      Count how many words in a sentence.
      inputs: [..., time_steps]
      sen_lens: [...]
      """
      x_binary = tf.cast(tf.not_equal(inputs, padding_token), tf.int32)
      sen_lens = tf.reduce_sum(x_binary, axis=-1)
      ones = tf.ones_like(sen_lens)
      sen_lens = tf.where(
          tf.equal(sen_lens, utils.PAD_IDX), x=ones, y=sen_lens
      )
      return sen_lens
  
file_path: delta/delta/layers/utils.py
imports: import math
  import delta.compat
  from tensorflow.python.keras import backend
  import delta.utils
label_desc: Use image node_id 3 for calling a global function with example usage: compute_sen_lens(inputs, padding_token) and returns: sen_lens