tf.nn.embedding_lookup()的使用
2017-05-27 15:04
190 查看
tf.nn.embedding_lookup(params, ids, partition_strategy=’mod’, name=None, validate_indices=True, max_norm=None)
首先通过一下一个简单的例子来了解一下tf.nn.embedding_lookup()的用法
a = tf.constant([[1,2,3],[4,5,6],[7,8,9],[10,11,12]]) >>>a.eval() Out[51]: array([[ 1, 2, 3], [ 4, 5, 6], [ 7, 8, 9], [10, 11, 12]], dtype=int32) tf.nn.embedding_lookup(a,[0,1]).eval() >>>Out[52]: array([[1, 2, 3], [4, 5, 6]], dtype=int32) tf.nn.embedding_lookup(a,[[0,1],[1,2]]).eval() >>>Out[53]: array([[[1, 2, 3], [4, 5, 6]], [[4, 5, 6], [7, 8, 9]]], dtype=int32)1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[/code]
参数说明:
params: 表示完整的嵌入张量,或者除了第一维度之外具有相同形状的P个张量的列表,表示经分割的嵌入张量。
ids: 一个类型为int32或int64的Tensor,包含要在params中查找的id
partition_strategy: 指定分区策略的字符串,如果len(params)> 1,则相关。当前支持“div”和“mod”。 默认为“mod”
name: 操作名称(可选)
validate_indices: 是否验证收集索引
max_norm: 如果不是None,嵌入值将被l2归一化为max_norm的值
(function () {('pre.prettyprint code').each(function () {var lines = (this).text().split(′\n′).length;varnumbering = $('').addClass('pre-numbering').hide();
(this).addClass(′has−numbering′).parent().append(numbering);
for (i = 1; i
相关文章推荐
- tf.nn.embedding_lookup()笔记
- tensorflow中embedding_lookup, tf.gather以及tf.nn.embedding_lookup_sparse的理解
- tf.nn.embedding_lookup()的用法
- tf.nn.embedding_lookup理解
- 对 tensorflow 中 tf.nn.embedding_lookup 函数的解释
- Tensorflow学习---tf.nn.embedding_lookup 4000
- tf.nn.embedding_lookup TensorFlow embedding_lookup 函数最简单实例
- tf.nn.embedding_lookup
- TensorFlow中 tf.nn.embedding_lookup
- tf.nn.embedding_lookup()的参数形式
- tf.nn.embedding_lookup TensorFlow embedding_lookup 函数最简单实例
- tf.nn.embedding_lookup
- tf.nn.embedding_lookup简单介绍
- TensorFlow - tf.nn.embedding_lookup
- tf.nn.embedding_lookup中关于partition_strategy参数详解
- tensorflow tf.nn.embedding_lookup(embeddings, train_inputs)解释
- tf.nn.pool()使用例子:TensorFlow对一维数据进行池化
- tensorflow 笔记11:tf.nn.dropout() 的使用
- Tensorflow-tf.nn.embedding_lookup函数原理
- [tensorflow] tf.nn.sparse_softmax_cross_entropy_with_logits的使用方法及常见报错