Bootstrap

TersorFlow——入门

#《TensorFlow实战Google深度学习框架》学习笔记

计算图

import tensorflow as tf
a = tf.constant([1.0,2.0],name="a")
b = tf.constant([2.0,3.0],name="b")
result = a+b
#tf.get_default_graph()获取当前默认的计算图
#可以通过a.graph查看张量所属的计算图。因为没有指定所以这个计算图应该等于当前默认的计算图。
print(a.graph is tf.get_default_graph())
True
#tf.Graph()来生成新的计算图,不同计算图上的张量和运算都不会共享
g1 = tf.Graph()
with g1.as_default():
    #在计算图g1中定义变量‘v’,并设置初始值为0.
    v = tf.get_variable("v",shape=[1],initializer = tf.zeros_initializer)
    
g2 = tf.Graph()
with g2.as_default():
    #在计算图g1中定义变量‘v’,并设置初始值为1.
    v = tf.get_variable("v",shape=[1]

悦读

道可道,非常道;名可名,非常名。 无名,天地之始,有名,万物之母。 故常无欲,以观其妙,常有欲,以观其徼。 此两者,同出而异名,同谓之玄,玄之又玄,众妙之门。