|TensorFlow 1 version||View source on GitHub|
Looks up embeddings for the given
ids from a list of tensors.
tf.nn.embedding_lookup( params, ids, max_norm=None, name=None )
This function is used to perform parallel lookups on the list of tensors in
params. It is a generalization of
interpreted as a partitioning of a large embedding tensor.
len(params) > 1, each element
ids is partitioned between the
params according to the "div" partition strategy, which means we
assign ids to partitions in a contiguous manner. For instance, 13 ids are
split across 5 partitions as:
[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10], [11, 12]].
If the id space does not evenly divide the number of partitions, each of the
(max_id + 1) % len(params) partitions will be assigned one more id.
The results of the lookup are concatenated into a dense
tensor. The returned tensor has shape
shape(ids) + shape(params)[1:].
||A single tensor representing the complete embedding tensor, or a list of tensors all of same shape except for the first dimension, representing sharded embedding tensors following "div" partition strategy.|
||A name for the operation (optional).|
For instance, if
or a list of matrices:
The output will be a 3x2 matrix: