placeholder函数相当于一个占位符,tf.placeholder(dtype, shape=None, name=None)

  • dtype:数据类型。常用的是tf.float32,tf.float64等数值类型
  • shape:数据形状。默认是None,就是一维值,也可以多维,比如:[None,3],表示列是3,行不一定
  • name:名称。
input1 = tf.placeholder(tf.float32)
input2 = tf.placeholder(tf.float32) output = tf.multiply(input1,input2)
with tf.Session() as sess:
print(sess.run(output,feed_dict={input1:[7.],input2:[2.]})) # [14.]

tensorflow学习之tf.placeholder的更多相关文章

  1. TensorFlow 学习笔记(2)----placeholder的使用

    此系列将会每日持续更新,欢迎关注 在TensorFlow中输入值的方式是通过placeholder来实现 例如:做两个数的乘法时,是先准备好两个place, 再将输出值定义成两数的乘法 最后利用ses ...

  2. TensorFlow 辨异 —— tf.placeholder 与 tf.Variable

    https://blog.csdn.net/lanchunhui/article/details/61712830 https://www.cnblogs.com/silence-tommy/p/70 ...

  3. Tensorflow 学习笔记 -----tf.where

    TensorFlow函数:tf.where 在之前版本对应函数tf.select 官方解释: tf.where(input, name=None)` Returns locations of true ...

  4. tensorflow 学习笔记-- tf.reduce_max、tf.sequence_mask

    1.tf.reduce_max函数的作用:计算张量的各个维度上的元素的最大值.例子: import tensorflow as tfmax_value = tf.reduce_max([1, 3, 2 ...

  5. tensorflow学习之tf.assign

    tf.assign(ref, value, validate_shape=None, use_locking=None, name=None), 函数功能是将value赋值给ref ref必须是tf. ...

  6. tensorflow学习之tf.truncated_normal和tf.random_noraml的区别

    tf版本1.13.1,CPU 最近在tf里新学了一个函数,一查发现和tf.random_normal差不多,于是记录一下.. 1.首先是tf.truncated_normal函数 tf.truncat ...

  7. 深度学习原理与框架-Tensorflow基本操作-变量常用操作 1.tf.random_normal(生成正态分布随机数) 2.tf.random_shuffle(进行洗牌操作) 3. tf.assign(赋值操作) 4.tf.convert_to_tensor(转换为tensor类型) 5.tf.add(相加操作) tf.divide(相乘操作) 6.tf.placeholder(输入数据占位

    1. 使用tf.random_normal([2, 3], mean=-1, stddev=4) 创建一个正态分布的随机数 参数说明:[2, 3]表示随机数的维度,mean表示平均值,stddev表示 ...

  8. TensorFlow学习笔记——节点(constant、placeholder、Variable)

    一. constant(常量) constant是TensorFlow的常量节点,通过constant方法创建,其是计算图(Computational Graph)中的起始节点,是传入数据. 创建方式 ...

  9. tensorflow学习之(四)使用placeholder 传入值

    #placeholder 传入值 import tensorflow as tf """ tf.Variable:主要在于一些可训练变量(trainable variab ...

随机推荐

  1. linux高性能服务器编程pdf免费下载

    百度云盘:链接: https://pan.baidu.com/s/1pLp4hHx 密码: wn4k

  2. hive严格模式

    说真的,这个模式在我做sql开发的岁月里,从未用到过.用的都是动态分区非严格模式. 我的好友东岳同学在车上问我.确实问到了我 .体现出了我基本功不扎实的情况. 1.what is Hive严格模式 H ...

  3. layui 源码解读(部分)

    <!DOCTYPE html> <head> </head> <body> <input type="button" id=& ...

  4. tensorflow的变量作用域

    一.由来 深度学习中需要使用大量的变量集,以往写代码我们只需要做全局限量就可以了,但在tensorflow中,这样做既不方便管理变量集,有不便于封装,因此tensorflow提供了一种变量管理方法:变 ...

  5. React 项目 ant design 的 CheckboxGroup 验证

    使用 ant design 提供的 getFieldDecorator 进行验证 一般开始使用默认选中 <FormItem> {getFieldDecorator('checkProtoc ...

  6. QtCreator常用之快捷键

    1. Ctrl(按住)+ Tab快速切换已打开的文件 2. 自动添加成员函数实体(.cpp)定义: 将光标移动到h文件中的方法声明. 按Alt(按住)+ Enter,再按回车键 将在cpp中添加该函数 ...

  7. 类锁和对象锁,synchronized修饰static方法与非static方法的区别

    当synchronized修饰一个static方法时,多线程下,获取的是类锁(即Class本身,注意:不是实例), 作用范围是整个静态方法,作用的对象是这个类的所有对象. 当synchronized修 ...

  8. windows下开启远程连接Mysql

    使用“Ctrl + R”组合键快速打开cmd窗口,并输入“cmd”命令,打开cmd窗口.  使用“mysql -uroot -proot”命令可以连接到本地的mysql服务.  使用“use mysq ...

  9. springboot学习日志(二)-- thymeleaf学习

    本次学习如何使用thymeleaf以及相关语法1.在上一章写的那样 引入jar包到maven工程 <dependency> <groupId>org.springframewo ...

  10. 关于servlet-api.jar和jsp-api.jar的选择和使用

    选择哪个依赖 javax包下都是jdk提供接口规范,由第三方服务器厂商自己来实现. jsp-api的依赖发生如下了2次迁移: javax.servlet.jsp-api==>javax.serv ...