class_docstr: A `Trimmer` that allocates a length budget to segments in order.
  
  A `Trimmer` that allocates a length budget to segments in order. It selects
  elements to drop, according to a max sequence length budget, and then applies
  this mask to actually drop the elements. See `generate_mask()` for more
  details.
  
  Example:
  
  >>> a = tf.ragged.constant([['a', 'b', 'c'], [], ['d']])
  >>> b = tf.ragged.constant([['1', '2', '3'], [], ['4', '5', '6', '7']])
  >>> trimmer = tf_text.WaterfallTrimmer(4)
  >>> trimmer.trim([a, b])
  [<tf.RaggedTensor [[b'a', b'b', b'c'], [], [b'd']]>,
   <tf.RaggedTensor [[b'1'], [], [b'4', b'5', b'6']]>]
  
  Here, for the first pair of elements, `['a', 'b', 'c']` and `['1', '2', '3']`,
  the `'2'` and `'3'` are dropped to fit the sequence within the max sequence
  length budget.
class_docstr_tok: ["A","`","Trimmer","`","that","allocates","a","length","budget","to","segments","in","order",".","A","`","Trimmer","`","that","allocates","a","length","budget","to","segments","in","order",".","It","selects","elements","to","drop",",","according","to","a","max","sequence","length","budget",",","and","then","applies","this","mask","to","actually","drop","the","elements",".","See","`","generate_mask","(",")","`","for","more","details",".","Example",":",">",">",">","a","=","tf.ragged.constant","(","[","[","'","a","'",",","'","b","'",",","'","c","'","]",",","[","]",",","[","'d","'","]","]",")",">",">",">","b","=","tf.ragged.constant","(","[","[","'","1","'",",","'","2","'",",","'","3","'","]",",","[","]",",","[","'","4","'",",","'","5","'",",","'","6","'",",","'","7","'","]","]",")",">",">",">","trimmer","=","tf_text.WaterfallTrimmer","(","4",")",">",">",">","trimmer.trim","(","[","a",",","b","]",")","[","<","tf.RaggedTensor","[","[","b","'","a","'",",","b","'","b","'",",","b","'","c","'","]",",","[","]",",","[","b'd","'","]","]",">",",","<","tf.RaggedTensor","[","[","b","'","1","'","]",",","[","]",",","[","b","'","4","'",",","b","'","5","'",",","b","'","6","'","]","]",">","]","Here",",","for","the","first","pair","of","elements",",","`","[","'","a","'",",","'","b","'",",","'","c","'","]","`","and","`","[","'","1","'",",","'","2","'",",","'","3","'","]","`",",","the","`","'","2","'","`","and","`","'","3","'","`","are","dropped","to","fit","the","sequence","within","the","max","sequence","length","budget","."]
docstr: Creates an instance of `WaterfallTruncator`.
  
  Args:
    max_seq_length: a scalar `Tensor` or a 1D `Tensor` of type int32 that
      describes the number max number of elements allowed in a batch. If a
      scalar is provided, the value is broadcasted and applied to all values
      across the batch.
    axis: Axis to apply trimming on.
docstr_tok: ["Creates","an","instance","of","`","WaterfallTruncator","`",".","Args",":","max_seq_length",":","a","scalar","`","Tensor","`","or","a","1D","`","Tensor","`","of","type","int32","that","describes","the","number","max","number","of","elements","allowed","in","a","batch",".","If","a","scalar","is","provided",",","the","value","is","broadcasted","and","applied","to","all","values","across","the","batch",".","axis",":","Axis","to","apply","trimming","on","."]
code: def __init__(self, max_seq_length, axis=-1):
      """Creates an instance of `WaterfallTruncator`.
  
      Args:
        max_seq_length: a scalar `Tensor` or a 1D `Tensor` of type int32 that
          describes the number max number of elements allowed in a batch. If a
          scalar is provided, the value is broadcasted and applied to all values
          across the batch.
        axis: Axis to apply trimming on.
      """
      self._max_seq_length = max_seq_length
      self._axis = axis
  
imports: import abc
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops.ragged import ragged_array_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow_text.python.ops import item_selector_ops
  from tensorflow.python.framework import load_library
  from tensorflow.python.platform import resource_loader
  from tensorflow.python.ops import while_loop
label_desc: Use image node_id 1 to create a new WaterfallTrimmer object from inherited base classes: Trimmer with example: obj = WaterfallTrimmer(max_seq_length, axis)