tf.contrib.layers.embed_sequence
Stay organized with collections
Save and categorize content based on your preferences.
Maps a sequence of symbols to a sequence of embeddings.
tf.contrib.layers.embed_sequence(
ids, vocab_size=None, embed_dim=None, unique=False, initializer=None,
regularizer=None, trainable=True, scope=None, reuse=None
)
Typical use case would be reusing embeddings between an encoder and decoder.
Args |
ids
|
[batch_size, doc_length] Tensor of type int32 or int64
with symbol ids.
|
vocab_size
|
Integer number of symbols in vocabulary.
|
embed_dim
|
Integer number of dimensions for embedding matrix.
|
unique
|
If True , will first compute the unique set of indices, and then
lookup each embedding once, repeating them in the output as needed.
|
initializer
|
An initializer for the embeddings, if None default for
current scope is used.
|
regularizer
|
Optional regularizer for the embeddings.
|
trainable
|
If True also add variables to the graph collection
GraphKeys.TRAINABLE_VARIABLES (see tf.Variable ).
|
scope
|
Optional string specifying the variable scope for the op, required
if reuse=True .
|
reuse
|
If True , variables inside the op will be reused.
|
Returns |
Tensor of [batch_size, doc_length, embed_dim] with embedded sequences.
|
Raises |
ValueError
|
if embed_dim or vocab_size are not specified when
reuse is None or False .
|
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.
[[["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 2020-10-01 UTC."],[],[]]