首页 > 其他 > 详细

tf.placeholder

时间:2018-08-23 12:44:16      阅读:188      评论:0      收藏:0      [点我收藏+]
tf.placeholder
placeholder(
    dtype,
    shape=None,
    name=None
)

功能说明:

是一种占位符,在执行时候需要为其提供数据

参数列表:

参数名必选类型说明
dtype dtype 占位符数据类型
shape 1 维整形张量或 array 占位符维度
name string 占位符名称

 
#!/usr/bin/python

import tensorflow as tf
import numpy as np

x = tf.placeholder(tf.float32,[None,3])
y = tf.matmul(x,x)
with tf.Session() as sess:
    rand_array = np.random.rand(3,3)
    print(sess.run(y,feed_dict={x:rand_array}))

 

tf.placeholder

原文:https://www.cnblogs.com/superxuezhazha/p/9523007.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!