class_docstr: A class encapsulating the logic for selecting items.
  
  `ItemSelector` implementations contain algorithms for selecting items in a
  `RaggedTensor`. Users of `ItemSelector` implementations can call
  `get_selection_mask()` to retrieve a bool `RaggedTensor` mask indicating the
  items that have been selected. For example:
  
  >>> inputs = tf.ragged.constant([
  ...     [1, 2, 3, 4],
  ...     [100, 200]
  ...   ])
  >>> tf.random.set_seed(1234)
  >>> selector = RandomItemSelector(3, .5)
  >>> selected = selector.get_selection_mask(inputs, axis=1)
  >>> print(selected)
  <tf.RaggedTensor [[False, True, True, False],
                    [False, True]]>
  
  
  An important use case for these classes is in creating inputs for masked
  language model training dataset preparation. See `masked_language_model` for
  an example of using the selectors in such a context.
  
  Subclass writers will typically implement a selection algorithm by overriding
  `get_selection_mask()`.
  
  A helper function `get_selectable()` is provided to help subclass writers
  filter out excluded items from selection (e.g. CLS and SEP for bert style
  models). This will frequently serve as a prefilter for subclass item
  selection (see e.g. the implementation of `RandomItemSelector`. The base class
  behavior is to simply return the mask obtained by filtering out items listed
  in `unselectable_ids`.
docstr: Return a boolean mask of items that can be chosen for selection.
  
  The default implementation marks all items whose IDs are not in the
  `unselectable_ids` list. This can be overridden if there is a need for
  a more complex or algorithmic approach for selectability.
  
  Args:
    input_ids: a `RaggedTensor`.
    axis: axis to apply selection on.
  
  Returns:
    a `RaggedTensor` with dtype of bool and with shape
    `input_ids.shape[:axis]`. Its values are True if the
    corresponding item (or broadcasted subitems) should be considered for
    masking. In the default implementation, all `input_ids` items that are not
    listed in `unselectable_ids` (from the class arg) are considered
    selectable.
docstr_tok: ["Return","a","boolean","mask","of","items","that","can","be","chosen","for","selection",".","The","default","implementation","marks","all","items","whose","IDs","are","not","in","the","`","unselectable_ids","`","list",".","This","can","be","overridden","if","there","is","a","need","for","a","more","complex","or","algorithmic","approach","for","selectability",".","Args",":","input_ids",":","a","`","RaggedTensor","`",".","axis",":","axis","to","apply","selection","on",".","Returns",":","a","`","RaggedTensor","`","with","dtype","of","bool","and","with","shape","`","input_ids.shape","[",":","axis","]","`",".","Its","values","are","True","if","the","corresponding","item","(","or","broadcasted","subitems",")","should","be","considered","for","masking",".","In","the","default","implementation",",","all","`","input_ids","`","items","that","are","not","listed","in","`","unselectable_ids","`","(","from","the","class","arg",")","are","considered","selectable","."]
code: def get_selectable(self, input_ids, axis):
      """Return a boolean mask of items that can be chosen for selection.
  
      The default implementation marks all items whose IDs are not in the
      `unselectable_ids` list. This can be overridden if there is a need for
      a more complex or algorithmic approach for selectability.
  
      Args:
        input_ids: a `RaggedTensor`.
        axis: axis to apply selection on.
  
      Returns:
        a `RaggedTensor` with dtype of bool and with shape
        `input_ids.shape[:axis]`. Its values are True if the
        corresponding item (or broadcasted subitems) should be considered for
        masking. In the default implementation, all `input_ids` items that are not
        listed in `unselectable_ids` (from the class arg) are considered
        selectable.
      """
      # merge to the desired axis
      input_ids = (
          input_ids.merge_dims(1, axis) if axis > 1 else input_ids
      )
  
      all_selectable_flats = [
          ragged_functional_ops.map_flat_values(
              math_ops.not_equal, input_ids, i
          ).flat_values
          for i in self._unselectable_ids
      ]
  
      # if there are no blocked ids, mark everything as selectable
      if all_selectable_flats:
          reduce_flat = math_ops.reduce_all(
              all_selectable_flats, axis=0
          )
      else:
          reduce_flat = array_ops.ones_like(
              input_ids.flat_values, dtype=dtypes.bool
          )
  
      # reduce to the requested axis and broadcast to match original shape
      axis = array_ops.get_positive_axis(
          axis, input_ids.ragged_rank + input_ids.flat_values.shape.rank
      )
      results = input_ids.with_flat_values(reduce_flat)
      if axis < input_ids.ragged_rank:
          reduce_axis = list(range(input_ids.ragged_rank, axis, -1))
          results = math_ops.reduce_all(results, reduce_axis)
  
      return results
  
imports: 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 gen_array_ops
  from tensorflow.python.ops import map_fn
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops.ragged import ragged_array_ops
  from tensorflow.python.ops.ragged import ragged_functional_ops
  from tensorflow.python.ops.ragged import ragged_math_ops
  from tensorflow.python.ops.ragged import ragged_tensor
label_desc: Use image node_id 3 for calling the ItemSelector obj's underlying member method code with example usage: obj.get_selectable(input_ids, axis) and returns: results