莫烦tensorflow教程笔记(三)
来源:互联网 发布:charindex函数 sql 编辑:程序博客网 时间:2024/05/29 07:20
tensorflow中placeholder的用法
import tensorflow as tfimort numpy as np
input1 = tf.placeholder(tf.float32) input2 = tf.placeholder(tf.float32) #为输入input1和input2预留空间,此处也可以指定shape,见下面的例子output = tf.multiply(input1,input2) # 教程中使用的是mul
with tf.Session() as session: print(session.run(output,feed_dict={input1:[7.],input2:[2.]})) #输出结果为[14.]
input3 = tf.placeholder(tf.float32,[1,3])input4 = tf.placeholder(tf.float32,[1,3]) #输入的是1行3列的数组output = tf.multiply(input3,input4) #对应位分别相乘
with tf.Session() as session: print(session.run(output,feed_dict={input3:np.array([1,2,3]),input4:np.array([1,2,3])})) # 将array([1,2,3])分别赋值给input3,input4 ,输出结果为[[1.,4.,9.]]
阅读全文
0 0
- 莫烦tensorflow教程笔记(三)
- 莫烦tensorflow教程笔记(一)
- 莫烦tensorflow教程笔记(二)
- 莫烦tensorflow教程笔记(四)
- 莫烦tensorflow教程笔记(五)
- 莫烦tensorflow教程笔记(六)
- tensorflow学习笔记(三):tensorflow 基础知识
- TensorFlow学习笔记(三)
- TensorFlow学习笔记(三)
- TensorFlow官方教程学习笔记(三)——MNIST入门(续)
- TensorFlow 教程 - 新手入门笔记
- tensorflow教程 cifar10 笔记
- TensorFlow学习笔记(三):TensorFlow实现逻辑回归模型
- tensorflow学习笔记(三):损失函数
- TensorFlow学习笔记(三):深层神经网络
- python tensorflow学习笔记(三)运算
- TensorFlow学习笔记(三):数据读取
- TensorFlow官方教程学习笔记之1-TensorFlow入门教程(Getting Started With TensorFlow)
- 创建定性用户画像
- Android自定义View
- 使用Eclipse插件把项目托管到GitLab
- 在看不见的战场上,连月硝烟的年底,支付宝再次败下阵来
- lintcode--跳跃游戏--跳跃游戏Ⅱ
- 莫烦tensorflow教程笔记(三)
- 在Android 7.0隐藏导航栏和状态栏的一些方法
- 读取文件并相应一个文件
- 多线程例子:wait与notify、sleep
- Could not load [oracle/sql/converter_xcharset/lx20354.glb]解决方法
- 微信公众号关键词自动回复二条信息
- 将浮点数用分数表示
- 用来查看插件自带函数的神技
- Paxos的工程实践之Hypertable。