原创

tensorflow之张量-常量学习笔记

tensorflow = tensor + flow = data + flow

#!/usr/bin/env python
# coding: utf-8

# # tensorflow = tensor + flow = data + flow

# In[1]:


import tensorflow as tf


# In[2]:


a = tf.constant(2) #tensorflow张量
b = tf.constant(5) #tensorflow张量
#运算公式 opt
x = tf.add(a,b)


# In[6]:


writer = tf.summary.FileWriter("C:\Python37")
writer.add_graph(tf.get_default_graph())
with tf.Session() as sess:
    print(sess.run(x))
writer.flush
writer.close()


# In[2]:


a = tf.constant(2,name="a") #tensorflow张量 重命名
b = tf.constant(5,name="b") #tensorflow张量 重命名
#运算公式 opt
x = tf.add(a,b,name="opt1") #方法名重命名


# In[3]:


writer = tf.summary.FileWriter("C:\Python37")
writer.add_graph(tf.get_default_graph())
with tf.Session() as sess:
    print(sess.run(x))
writer.flush
writer.close()

# In[ ]:
正文到此结束
该篇文章的评论功能已被站长关闭
本文目录