Save the date! Google I/O returns May 18-20 Register now


Maps integers from a vocabulary to integer indices.

Inherits From: IntegerLookup, PreprocessingLayer, Layer, Module



View source

Fits the state of the preprocessing layer to the dataset.

Overrides the default adapt method to apply relevant preprocessing to the inputs before passing to the combiner.

data The data to train on. It can be passed either as a Dataset, or as a numpy array.
reset_state Optional argument specifying whether to clear the state of the layer at the start of the call to adapt. This must be True for this layer, which does not support repeated calls to adapt.


View source


View source

Sets vocabulary data for this layer with inverse=False.

This method sets the vocabulary for this layer directly, instead of analyzing a dataset through 'adapt'. It should be used whenever the vocab information is already known. If vocabulary data is already present in the layer, this method will either replace it

vocab An array of string tokens.

ValueError If there are too many inputs, the inputs do not match, or input data is missing.


View source