code: def lengths_from_eos_idx(eos_idx, max_length):
      return tf.compat.v1.where(
          tf.equal(eos_idx, 0),
          tf.ones_like(eos_idx)
          * tf.cast(max_length, dtype=eos_idx.dtype),
          eos_idx + 1,
      )
  
imports: import tensorflow
label_desc: Use image node_id 4 for calling a global function with example usage: lengths_from_eos_idx(eos_idx, max_length) and returns: tf