简要概述tensorflow的核心概念和功能。 什么是tensorflow 如何输入数据 如何进行计算 如何创建变量
# -*- coding: utf-8 -*-
import os
import warnings
os.environ['TF_CPP_MIN_LOG_LEVEL']='3'
warnings.filterwarnings('ignore')
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.patches as mpatches
def tf_reset():
try:
sess.close()
except:
pass
tf.reset_default_graph()
return tf.Session()
#0.What is Tensorflow
sess = tf_reset()
a = tf.constant(1.0)
b = tf.constant(2.0)
c=a+b
c_run =sess.run(c)
print('c={0}'.format(c_run))
#1.How to input data
sess =tf_reset()
a=tf.placeholder(dtype=tf.float32,shape=[1],name='a_placeholder')
b=tf.placeholder(dtype=tf.float32,shape=[1],name='b_placeholder')
c=a+b
c0_run =sess.run(c,feed_dict={a:[1.0],