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

tf.compat.v1.keras.layers.experimental.preprocessing.IntegerLookup

Maps integers from a vocabulary to integer indices.

Inherits From: IntegerLookup, PreprocessingLayer, Layer, Module

Methods

adapt

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.

Arguments
data The data to train on. It can be passed either as a tf.data 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.

get_vocabulary

View source

set_vocabulary

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

Arguments
vocab An array of string tokens.

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

vocab_size

View source