text.LastNItemSelector

An ItemSelector that selects the last n items in the batch.

num_to_select An int which is the leading number of items to select.
unselectable_ids (optional) A list of int ids that cannot be selected. Default is empty list.

unselectable_ids

Methods

get_selectable

View source

See get_selectable() in superclass.

get_selection_mask

View source

Returns a mask of items that have been selected.

The default implementation simply returns all items not excluded by get_selectable.

Args
input_ids A RaggedTensor.
axis (optional) An int detailing the dimension to apply selection on. Default is the 1st dimension.

Returns
a RaggedTensor with shape input_ids.shape[:axis]. Its values are True if the corresponding item (or broadcasted subitems) should be selected.