|TensorFlow 1 version||View source on GitHub|
Looks up embeddings for the given ids and weights from a list of tensors.
tf.nn.embedding_lookup_sparse( params, sp_ids, sp_weights, combiner=None, max_norm=None, name=None )
This op assumes that there is at least one id for each row in the dense tensor represented by sp_ids (i.e. there are no rows with empty features), and that all the indices of sp_ids are in canonical row-major order.
sp_weights (if not None) are
SparseTensors with rank of 2.
Embeddings are always aggregated along the last dimension.
It also assumes that all id values lie in the range [0, p0), where p0 is the sum of the size of params along dimension 0.
len(params) > 1, each element of
sp_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.
||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.|
N x M