TensorFlow语法点滴

1. tf.variable_scope生成一个上下文管理器,用于获取已经生成的变量

with tf.variable_scope('pnet'):
        data = tf.placeholder(tf.float32, (None,None,None,3), 'input')
        pnet = PNet({'data':data})
        pnet.load(os.path.join(model_path, 'det1.npy'), sess)

 

2.计算图。在程序的开始,最好显式声明一个计算图,多个不同的图可以在不同的线程中计算,显卡的优势就显示出来了。

with tf.Graph().as_default():

  

3.

 

4.

 

5.

 

6.

 

posted @ 2018-04-14 21:36  路边的十元钱硬币  阅读(177)  评论(0编辑  收藏  举报