placeholder使用

简介: placeholder使用

代码如下:

#!/usr/bin/python
import tensorflow as tf
x1 = tf.placeholder(tf.int32,shape=[1],name='x1')
x2 = tf.constant(5,name = 'x2')
result = x1 + x2
with tf.Session() as sess:
        print(sess.run(result,{x1:[3]}))

x1 定义为placeholder

x2定义为constant

  • 执行结果如下
tf.placeholder(
dtype,
shape=None,
name=None
)

dtype: The type of elements in the tensor to be fed.

shape: The shape of the tensor to be fed (optional). If the shape is not specified, you can feed a tensor of any shape.

name: A name for the operation (optional).


目录
打赏
0
0
0
0
4
分享
相关文章
placeholder和value的区别
placeholder和value的区别
Element el-radio 单选框详解
本文目录 1. 用途 2. 单选框 3. 单选框样式 4. 单选框组 4. 单选框组样式 5. 尺寸调节 6. 绑定值变化事件 7. 小结
1667 0
Element el-radio 单选框详解
v-model指令获取常见表单项的内容 input,textarea,radio,checkbox,select
本文介绍了Vue.js中v-model指令的作用和语法,并通过示例代码展示了如何使用v-model来获取不同类型的表单元素(如文本输入框、文本域、复选框、单选框和下拉菜单)的内容。
使用 div 实现 input、textarea 输入框,并支持 placeholder 属性(解决浏览器兼容问题)
使用 div 实现 input、textarea 输入框,并支持 placeholder 属性(解决浏览器兼容问题)
252 0
Element el-input 输入框详解
本文目录 1. 用途 2. 输入框 2.1 输入框基本功能 2.2 显示占位文本 2.3 禁用 2.4 可清空的输入框 2.5 显示密码框 2.6 显示图标 2.7 输入长度限制 3. 文本域
2749 0
Element el-input 输入框详解
input placeholder 兼容性处理
input placeholder 兼容性处理
267 0