#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Jia ShiLin
import tensorflow as tf
#type 重载
a =5.0
b = tf.constant(5.0)
sum1 = a+b
#def placheholder,两行三列,feed_dict一般和run一起用
plt = tf.placeholder(tf.float32,[2,3])
plt1 = tf.placeholder(tf.float32,[None,3])#可以不确定批次
with tf.Session(config=tf.ConfigProto(log_device_placement=True)) as sess:
print(sess.run(plt,feed_dict={plt:[[1,2,3],[4,5,6]]}))
print(sess.run(plt1,feed_dict={plt1:[[1,2,3],[4,5,6],[6,7,8]]}))
#sess
with tf.Session() as sess:
print(sess.run(sum1))
Session.run()方法以及placeholder 和feed_dict关键字
最新推荐文章于 2022-06-21 21:22:04 发布