Tensorflow中的命名空间scope

1、name_scope

  在tensorflow中有两种声明变量的方式,tf.get_variable()和tf.Variable().

  name_scope对于tf.get_variable()无效,只在tf.Variable()中起作用

    

  使用tf.Variable()这种方式创建变量时,首先会检查是否有此时要创建的变量name,如果存在则自动分配一个不同的变量name

    

 2、variable_scope

  variable_scope对于tf.get_variable()和tf.Variable()都起作用

    

  tf.Variable()不能使用变量复用的功能,而tf.get_variable()可以实现变量复用的功能

    

    

posted @ 2017-03-18 20:39  Miss_wang  阅读(1062)  评论(0编辑  收藏  举报