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

#!/usr/bin/env python
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np params=np.random.normal(loc=0.0,scale=1.0,size=[10,10]) ids=[1,2,3] with tf.Session() as sess:
print(sess.run(tf.nn.embedding_lookup(params,ids)))

输出:

[[ 1.7063815  -0.01654651 -0.64545987 -0.34758673  0.48317762  0.61799378
0.23066604 1.70424801 -0.96460893 1.46270563]
[ 0.54778326 -0.43954697 -0.3599735 -0.90806082 -0.73178132 -0.87372115
-0.36002708 0.18508744 -0.01786275 0.87135015]
[ 0.07694426 -1.55872459 -0.63802347 -1.5762184 -0.65273981 -1.62801055
0.08332559 1.03982988 -0.96005845 0.17954909]]

tf.nn.embedding_lookup TensorFlow embedding_lookup 函数最简单实例的更多相关文章

  1. tf.nn.conv2d。卷积函数

    tf.nn.conv2d是TensorFlow里面实现卷积的函数,参考文档对它的介绍并不是很详细,实际上这是搭建卷积神经网络比较核心的一个方法,非常重要 tf.nn.conv2d(input, fil ...

  2. tf.nn.softmax_cross_entropy_with_logits()函数的使用方法

    import tensorflow as tf labels = [[0.2,0.3,0.5], [0.1,0.6,0.3]]logits = [[2,0.5,1], [0.1,1,3]] a=tf. ...

  3. c++ 函数指针简单实例

    一开始看函数指针的时候我是很懵的,因为不知道它有什么用,之后慢慢就发现了自己的愚昧无知. 假设我们想实现一个数据结构,比如二叉搜索树,堆.又或者是一个快排,归并排序. 我们一般是直接在两个数要比较的时 ...

  4. 第三节,TensorFlow 使用CNN实现手写数字识别(卷积函数tf.nn.convd介绍)

    上一节,我们已经讲解了使用全连接网络实现手写数字识别,其正确率大概能达到98%,这一节我们使用卷积神经网络来实现手写数字识别, 其准确率可以超过99%,程序主要包括以下几块内容 [1]: 导入数据,即 ...

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

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

  6. tf.nn.conv2d卷积函数之图片轮廓提取

    一.tensorflow中二维卷积函数的参数含义:def conv2d(input, filter, strides, padding, use_cudnn_on_gpu=True, data_for ...

  7. 深度学习原理与框架-Tensorflow卷积神经网络-卷积神经网络mnist分类 1.tf.nn.conv2d(卷积操作) 2.tf.nn.max_pool(最大池化操作) 3.tf.nn.dropout(执行dropout操作) 4.tf.nn.softmax_cross_entropy_with_logits(交叉熵损失) 5.tf.truncated_normal(两个标准差内的正态分布)

    1. tf.nn.conv2d(x, w, strides=[1, 1, 1, 1], padding='SAME')  # 对数据进行卷积操作 参数说明:x表示输入数据,w表示卷积核, stride ...

  8. Tensorflow踩坑之tf.nn.bidirectional_dynamic_rnn()报错 “ValueError: None values not supported.”

    详细解决方法见链接:https://stackoverflow.com/questions/39808336/tensorflow-bidirectional-dynamic-rnn-none-val ...

  9. 【Tensorflow】tf.nn.atrous_conv2d如何实现空洞卷积?膨胀卷积

    介绍关于空洞卷积的理论可以查看以下链接,这里我们不详细讲理论: 1.Long J, Shelhamer E, Darrell T, et al. Fully convolutional network ...

随机推荐

  1. 关于 Form 表单的 enctype 属性

    enctype 属性一共有3个值 application/x-www-form-urlencoded 在发送前编码所有字符(默认) multipart/form-data 上传二进制数据, 所以在使用 ...

  2. Groovy入门(2-2)Groovy的eclipse插件安装

    1.安装eclipse插件 启动eclipse,点击help -> Install New Software... 在弹出的窗口中点击:Add... Groovy插件的地址:http://dis ...

  3. Oracle 存储过程简单语法

    一.无参数的存储过程 --创建存储过程create or replace procedure getdate as datetime varchar2(); begin select to_char( ...

  4. CentOS ping www.baidu.com 报错 name or service not know

    今天尝试安装了centos系统 玩一玩 刚刚装好的操作系统 ping www.baidu.com的时候  报出 name or service not known 查了好多资料,都没有很好的解决 最后 ...

  5. django的模型类管理器-----------数据库操作的封装

    模型实例方法 str():在将对象转换成字符串时会被调用. save():将模型对象保存到数据表中,ORM框架会转换成对应的insert或update语句. delete():将模型对象从数据表中删除 ...

  6. Lua编写wireshark插件初探——解析Websocket上的MQTT协议

    一.背景 最近在做物联网流量分析时发现, App在使用MQTT协议时往往通过SSL+WebSocket+MQTT这种方式与服务器通信,在使用SSL中间人截获数据后,Wireshark不能自动解析出MQ ...

  7. vue.js初识(一)

    一 什么是vue? Vue (读音 /vjuː/,类似于 view) 是一套用于构建用户界面的渐进式框架.与其它大型框架不同的是,Vue 被设计为可以自底向上逐层应用.Vue 的核心库只关注视图层,不 ...

  8. Oracle服务启动项

    七个服务的含义分别为: 1. Oracle ORCL VSS Writer Service: Oracle卷映射拷贝写入服务,VSS(Volume Shadow Copy Service)能够让存储基 ...

  9. ES6 new syntax of let and const (one)

    variable declarations : let, const,and block scope why we redefine the way about declarations? funct ...

  10. Jenkins持续集成演示

    1.去我们的仓库修改一下代码 为了节约时间,我直接在网页上改了. 我们把布局页的footer信息改一下: 然后提交. 2.切换到Jenkins可以看到已经在构建了 等待构建完成. 3.访问我们部署的地 ...