tf.contrib.layers.embedding_lookup_unique
Stay organized with collections
Save and categorize content based on your preferences.
Version of embedding_lookup that avoids duplicate lookups.
tf.contrib.layers.embedding_lookup_unique(
params, ids, partition_strategy='mod', name=None
)
This can save communication in the case of repeated ids.
Same interface as embedding_lookup. Except it supports multi-dimensional ids
which allows to not reshape input/output to fit gather.
Args |
params
|
A list of tensors with the same shape and type, or a
PartitionedVariable . Shape [index, d1, d2, ...] .
|
ids
|
A one-dimensional Tensor with type int32 or int64 containing the
ids to be looked up in params . Shape [ids1, ids2, ...] .
|
partition_strategy
|
A string specifying the partitioning strategy, relevant
if len(params) > 1 . Currently "div" and "mod" are supported. Default
is "mod" .
|
name
|
A name for this operation (optional).
|
Returns |
A Tensor with the same type as the tensors in params and dimension of
[ids1, ids2, d1, d2, ...] .
|
Raises |
ValueError
|
If params is empty.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.layers.embedding_lookup_unique\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/layers/python/layers/embedding_ops.py#L476-L514) |\n\nVersion of embedding_lookup that avoids duplicate lookups. \n\n tf.contrib.layers.embedding_lookup_unique(\n params, ids, partition_strategy='mod', name=None\n )\n\nThis can save communication in the case of repeated ids.\nSame interface as embedding_lookup. Except it supports multi-dimensional `ids`\nwhich allows to not reshape input/output to fit gather.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| `params` | A list of tensors with the same shape and type, or a `PartitionedVariable`. Shape `[index, d1, d2, ...]`. |\n| `ids` | A one-dimensional `Tensor` with type `int32` or `int64` containing the ids to be looked up in `params`. Shape `[ids1, ids2, ...]`. |\n| `partition_strategy` | A string specifying the partitioning strategy, relevant if `len(params) \u003e 1`. Currently `\"div\"` and `\"mod\"` are supported. Default is `\"mod\"`. |\n| `name` | A name for this operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` with the same type as the tensors in `params` and dimension of `[ids1, ids2, d1, d2, ...]`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|-----------------------|\n| `ValueError` | If `params` is empty. |\n\n\u003cbr /\u003e"]]