tf.contrib.layers.embed_sequence
来源:互联网 发布:广西网络教育培训网 编辑:程序博客网 时间:2024/06/07 10:57
简介
一般用于sequence2sequence网络,可完成对输入序列数据的嵌入工作。一般只需给出前三个参数。
tf.contrib.layers.embed_sequence(ids, vocab_size, embed_dim)
ids: 形状为[batch_size, doc_length]的int32或int64张量,也就是经过预处理的输入数据。
vocab_size: 输入数据的总词汇量,指的是总共有多少类词汇,不是总个数
embed_dim:想要得到的嵌入矩阵的维度
tensorflow官网原文
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.
See 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 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.
- tf.contrib.layers.embed_sequence
- tf.contrib.layers.xavier_initializer
- tensorflow图片归一化之tf.layers.batch_normalization/tf.nn.batch_normalization/tf.contrib.layers.batch_norm
- tensorflow学习——tf.layers.batch_normalization/tf.nn.batch_normalization/tf.contrib.layers.batch_norm
- tf API 研读1:tf.nn,tf.layers, tf.contrib概述
- tf.contrib
- tensorflow编程: Layers (contrib)
- Tensorflow contrib.layers 模块介绍
- tf.contrib.slim
- tf.contrib.slim
- tf.contrib.rnn.BasicLSTMCell, tf.contrib.rnn.MultiRNNCell深度解析
- tf.contrib.learn.preprocessing.VocabularyProcessor
- tf.contrib.learn快速入门
- tensorflow tf.layers.dense 实例
- #tensorflow学习笔记#tf.contrib.framework.get_or_create_global_step
- tensorflow之tf.contrib.learn Quickstart
- TensorFlow-4: tf.contrib.learn 快速入门
- 使用tf.contrib.learn构建输入函数
- webpack+vue+vueRouter模块化构建完整项目实例详细步骤-入门篇
- java过滤器原理分析以及实现,通过过滤器实现自动登陆
- Java消息中间件学习笔记二 -- JMS规范
- 设计模式六大原则(4):接口隔离原则
- 工程师也该学习机器学习了!
- tf.contrib.layers.embed_sequence
- 58-类模版的概念与意义
- ROC曲线,AUC
- 抽奖转盘
- 算法总结JS版(五)—— 快速排序(Quick Sort)
- Ubuntu 64bit下手动安装深度学习包Caffe记录(CPU)
- 经验总结-RecyclerView和SwipeRefreshLayout结合实现上拉和下拉刷新
- ServletContext和ServletConfig有什么区别
- JavaScript-原型、原型链