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. 微信获取token -1000

    最终翻看微信开发api找到需要去配置IP白名单.只需要配置访问来源IP即可.

  2. python openpyxl 简单使用

    1. 加载excel import openpyxl from openpyxl.utils import get_column_letter,column_index_from_string fro ...

  3. ARM汇编 汇编文件后缀.s与.S

    有两套汇编的语法: ARM公司的标准ARM汇编语言和GNU对ARM支持的GNU ARM汇编. ARM标准汇编语言即ARM公司的开发工具ADS里用的汇编语言: GNU汇编即在Linux下用GCC编译的汇 ...

  4. Linux 命令点滴

    .linux查看占用内存最多的程序 ;|head .查看占用cpu最多的程序 ;|head chown -R mysql:mysql /data/mysql_data chown -R mysql:m ...

  5. cm日志哪里看

    root@d001:/home/centos# find / |grep cloudera-scm-agent.log/opt/cm-5.13.0/log/cloudera-scm-agent/clo ...

  6. linux常用的命令一:系统工作命令

    系统工作命令: 帮助命令:man -h \ man --help(tips:‘--’长格式后用完整的选项名称,‘-’短格式后用单个字母缩写) echo命令:格式:echo [字符串|$变量] date ...

  7. 曙光浪潮IBM驱动

    https://pan.baidu.com/s/1lDrotg5jpdN_z0yOYyAo4w

  8. node.js入门学习(二)MIME模块,request和response对象,demo之不同url请求不同html页面,页面包含图片、样式css等静态资源

    一.构建http服务程序-根据不同请求做出不同响应 // 加载http模块 var http = require("http"); // 创建一个http服务对象 http.cre ...

  9. spring自带工具类

    在spring-core.jar包中,org.springframework.util package下有很多工具类,这些工具类十分具有参考意义.

  10. Python抽象类(abc模块)

    1.抽象类概念 抽象类是一个特殊的类,只能被继承,不能实例化 2.为什么要有抽象类 其实在未接触抽象类概念时,我们可以构造香蕉.苹果.梨之类的类,然后让它们继承水果这个基类,水果的基类包含一个eat函 ...