This layer provides options for condensing data into a categorical encoding
when the total number of tokens are known in advance. It accepts integer
values as inputs, and it outputs a dense or sparse representation of those
inputs. For integer inputs where the total number of tokens is not known,
use keras.layers.IntegerLookup instead.
The total number of tokens the layer should support. All
inputs to the layer must integers in the range 0 <= value <
num_tokens, or an error will be thrown.
output_mode
Specification for the output of the layer.
Values can be "one_hot", "multi_hot" or "count",
configuring the layer as follows:
For all output modes, currently only output up to rank 2 is
supported.
Defaults to "multi_hot".
sparse
Whether to return a sparse tensor; for backends that support
sparse tensors.
Call arguments
inputs
A 1D or 2D tensor of integer inputs.
count_weights
A tensor in the same shape as inputs indicating the
weight for each sample value when summing up in count mode.
Not used in "multi_hot" or "one_hot" modes.
Attributes
input
Retrieves the input tensor(s) of a symbolic operation.
Only returns the tensor(s) corresponding to the first time
the operation was called.
output
Retrieves the output tensor(s) of a layer.
Only returns the tensor(s) corresponding to the first time
the operation was called.
This method is the reverse of get_config,
capable of instantiating the same layer from the config
dictionary. It does not handle layer connectivity
(handled by Network), nor weights (handled by set_weights).
Args
config
A Python dictionary, typically the
output of get_config.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-07 UTC."],[],[]]