Tf.contrib.layers.embed_sequence_tensorflow

Source: Internet
Author: User
Brief introduction

Generally used in Sequence2sequence network, can complete the input sequence data embedding work. Generally, you only need to give the first three parameters.

Tf.contrib.layers.embed_sequence (IDs, Vocab_size, Embed_dim)

IDS: The Int32 or Int64 tensor of the shape [Batch_size, Doc_length], which is the preprocessed input data.

Vocab_size: The total vocabulary of the input data, refers to the total number of words, not the total number

Embed_dim: The dimension of the embedded matrix you want to get


TensorFlow Official Website Original

Tf.contrib.layers.embed_sequence


Embed_sequence (
Ids
Vocab_size=none,
Embed_dim=none,
Unique=false,
Initializer=none,
Regularizer=none,
Trainable=true,
Scope=none,
Reuse=none
)
Defined in tensorflow/contrib/layers/python/layers/encoders.py.


The Guide:layers (contrib) > Higher level OPS for building neural network Layers


Maps a sequence of symbols to a sequence of embeddings.


Typical use case would is 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, would 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. Variable).
Scope:optional string specifying the variable scope for the OP, required if reuse=true.
Reuse:if True, variables inside the OP would 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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.