tensorflow学习之tf.placeholder
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的更多相关文章
- TensorFlow 学习笔记(2)----placeholder的使用
此系列将会每日持续更新,欢迎关注 在TensorFlow中输入值的方式是通过placeholder来实现 例如:做两个数的乘法时,是先准备好两个place, 再将输出值定义成两数的乘法 最后利用ses ...
- TensorFlow 辨异 —— tf.placeholder 与 tf.Variable
https://blog.csdn.net/lanchunhui/article/details/61712830 https://www.cnblogs.com/silence-tommy/p/70 ...
- Tensorflow 学习笔记 -----tf.where
TensorFlow函数:tf.where 在之前版本对应函数tf.select 官方解释: tf.where(input, name=None)` Returns locations of true ...
- tensorflow 学习笔记-- tf.reduce_max、tf.sequence_mask
1.tf.reduce_max函数的作用:计算张量的各个维度上的元素的最大值.例子: import tensorflow as tfmax_value = tf.reduce_max([1, 3, 2 ...
- tensorflow学习之tf.assign
tf.assign(ref, value, validate_shape=None, use_locking=None, name=None), 函数功能是将value赋值给ref ref必须是tf. ...
- tensorflow学习之tf.truncated_normal和tf.random_noraml的区别
tf版本1.13.1,CPU 最近在tf里新学了一个函数,一查发现和tf.random_normal差不多,于是记录一下.. 1.首先是tf.truncated_normal函数 tf.truncat ...
- 深度学习原理与框架-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表示 ...
- TensorFlow学习笔记——节点(constant、placeholder、Variable)
一. constant(常量) constant是TensorFlow的常量节点,通过constant方法创建,其是计算图(Computational Graph)中的起始节点,是传入数据. 创建方式 ...
- tensorflow学习之(四)使用placeholder 传入值
#placeholder 传入值 import tensorflow as tf """ tf.Variable:主要在于一些可训练变量(trainable variab ...
随机推荐
- jmeter+ant 实现自动化接口测试环境配置
前置:安装jdk 1.8以上 一.安装jemeter 下载地址:http://jmeter.apache.org/download_jmeter.cgi 1.1 解压jmeter,放在某个目录,例如D ...
- vuex中this.$store.dispatch和this.$store.commit的区别(都是调用vuex中的方法。一个异步一个同步)
dispatch:含有异步操作,例如向后台提交数据,写法: this.$store.dispatch('action方法名',值) commit:同步操作,写法:this.$store.commit( ...
- CMDB架构需求实现
CMDB资产管理部分实现 需求 1.存储所有IT资产信息 2.数据可手动添加 3.硬件信息可自动收集 4.硬件信息可自动变更 5.可对其他系统灵活开放API 6.API接口安全认证 立业之本:定义表结 ...
- 【GDOI2017模拟12.9】最近公共祖先
题目 分析 首先,将这些节点按dfs序建一棵线段树. 因为按dfs序,所以在同一子树上的节点会放在线段树相邻的位置. 发现,对于一个位置x,它的权值只会对以x为根的子树造成影响. 当修改x时,用w[x ...
- List集合中对象的排序
使用到的是: Collections.sort(); 用法是: List<Book> list_book = new ArrayList<Book>(); Book book= ...
- grpc:What is gRPC
本文将介绍gRPC和protocol buffers.gRPC可以利用protocol buffers作为其接口定义语言(Interface Definition Language,IDL)和信息交换 ...
- 实战build-react(三)
安装 redux-thunk yarn add redux-thunk 或 npm install redux-thunk --save https://github.com/zalmoxisus/r ...
- BZOJ 1901 洛谷 P2617 ZOJ 2112 Dynamic Rankings
以下时空限制来自zoj Time limit 10000 ms Memory limit 32768 kB OS Linux Source Online Contest of Christopher' ...
- Tensorflow2.0变化
https://baijiahao.baidu.com/s?id=1627307436158652578&wfr=spider&for=pc https://zhidao.baidu. ...
- vsCode格式化插件
ESlint:是用来统一JavaScript代码风格的工具,不包含css.html等. 背景 近来研究前端,然后一直在百度上找VScode格式化(ESlint)的插件,结果找了半天都不靠谱.目前没有一 ...