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)

tf.nn.embedding_lookup函数的更多相关文章

  1. 【TensorFlow】tf.nn.embedding_lookup函数的用法

    tf.nn.embedding_lookup函数的用法主要是选取一个张量里面索引对应的元素.tf.nn.embedding_lookup(tensor, id):tensor就是输入张量,id就是张量 ...

  2. tf.nn.embedding_lookup函数的用法

    关于np.random.RandomState.np.random.rand.np.random.random.np.random_sample参考https://blog.csdn.net/lanc ...

  3. tf.nn.embedding_lookup函数【转载】

    转自:https://www.cnblogs.com/gaofighting/p/9625868.html //里边有两个很好理解的例子. tf.nn.embedding_lookup(params, ...

  4. 对 tensorflow 中 tf.nn.embedding_lookup 函数的解释

    http://stackoverflow.com/questions/34870614/what-does-tf-nn-embedding-lookup-function-do embedding_l ...

  5. tf.nn.embedding_lookup()的用法

    函数: tf.nn.embedding_lookup( params, ids, partition_strategy='mod', name=None, validate_indices=True, ...

  6. tf.nn.embedding_lookup TensorFlow embedding_lookup 函数最简单实例

    tf.nn.embedding_lookup TensorFlow embedding_lookup 函数最简单实例 #!/usr/bin/env python # -*- coding: utf-8 ...

  7. 深度学习原理与框架-CNN在文本分类的应用 1.tf.nn.embedding_lookup(根据索引数据从数据中取出数据) 2.saver.restore(加载sess参数)

    1. tf.nn.embedding_lookup(W, X) W的维度为[len(vocabulary_list), 128], X的维度为[?, 8],组合后的维度为[?, 8, 128] 代码说 ...

  8. tf.nn.embedding_lookup

    tf.nn.embedding_lookup(params, ids, partition_strategy=’mod’, name=None, validate_indices=True, max_ ...

  9. Tensorflow BatchNormalization详解:4_使用tf.nn.batch_normalization函数实现Batch Normalization操作

    使用tf.nn.batch_normalization函数实现Batch Normalization操作 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献 吴恩达deeplearnin ...

随机推荐

  1. 【枚举&数据结构】【P2484】 [SDOI2011]打地鼠

    Description 给定一个网格,每个格子上有一个数字.一次操作可以将 \(r~\times~c\) 的一块矩形的数字减去 \(1\).必须保证这个矩形中的数全部为正.每次操作的 \(r\) 和 ...

  2. BTC钱包对接流程

    BTC钱包对接流程: 部署钱包节点 分析钱包的API 通过JSON-RPC访问钱包API 部署测试 1.部署钱包节点 虚拟币交易平台对接所有的虚拟币之前,都要在自己的服务器上部署一个钱包节点,首先要找 ...

  3. laravel 实用扩展包

    1.beyondcode / laravel-self-diagnosis 环境检测.检测 php 版本.扩展 是否正常,数据库连接是否正常等 2.nunomaduro/larastan larave ...

  4. laravel 命令行输出进度条

    有时候我们想在命令行执行一些耗时的命令,我们可以利用 symfony 提供的进度条相关的类,来输出一个进度条,显示当前的处理进度. 参考:http://symfony.com/doc/current/ ...

  5. linux那些事

    useradd -m -d /home/changp -Gusers,dialout,video account_name 创建新的账号 passwd account_name 修改指定账号的密码

  6. 面试心得与总结---BAT、网易、蘑菇街

    作者:Xoper.ducky链接:https://www.nowcoder.com/discuss/3043来源:牛客网 之前实习的时候就想着写一篇面经,后来忙就给忘了,现在找完工作了,也是该静下心总 ...

  7. android studio run 的时候,报the apk file does not exist on disk,

    1.首先 clean rebuild,重启,不能解决的话,再找到这个 然后是这里: 不用填,点ok,ok即可,他喵的,卡我俩小时

  8. 七、新时间日期 API

    一.使用 LocalDate. LocalTime. LocalDateTime LocalDate. LocalTime. LocalDateTime 类的实例是不可变的对象,分别表示使用 ISO- ...

  9. angularJS 事件广播与接收

    发送消息: $scope.$emit(name, data) 或者 $scope.$broadcast(name, data); 接收消息: $scope.on(name,function(event ...

  10. idea 常用快捷使用

    一.智能提示 1.快速移动到错误代码 :Shift+F2 或者 f2/ 2.快速修复:Alt+Enter 3.快速生成括号:Ctrl+Shift+Enter 二.重构 1.重构功能汇总:Ctrl+Sh ...