博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Understand on the tf.variable_scope and tf.name_scope
阅读量:4079 次
发布时间:2019-05-25

本文共 1418 字,大约阅读时间需要 4 分钟。

Recent two weeks, I have spent much time on learning Tensorflow to implement my idea. Here, I would like to give some diferences between tf.variable_scope and tf.name_scope. Totally, these two method can summarize some basics operations into one node and show a clear graph visualized by TensorBoard. Next, I would like to highlight their differences.

First, we usually use the manner like w= tf.Variable(dtype=tf.float32, shape=[784, 10])) to define the variable w. Actually, the tensorflow would give a specific name for this variable in their graph, sometimes maybe like variable_1, variable_2, and so on like these. Occasionally, we would also like to define the w like this: w= tf.Variable(dtype=tf.float32, shape=[784, 10]), name=’w’). I think all these name methods are just for the compact visualization in the Tensorboard. In the same name_scope, variables with the same name would not allowed to be created andalso TF gives the errors.

Second, if the tf.variable_scope is used, the name of the variable would automatically be added a prefix with the variable scope name. In this regard, variables with the same names specified in the declaration would be fine, because a different variable scope name is added as their prefix.

Sometimes, we don’t not need to specify the variable name by the declaration, otherwise for reuse, which is another question and would be discussed when required in my future works.

转载地址:http://xoini.baihongyu.com/

你可能感兴趣的文章
大数据入门:ZooKeeper工作原理
查看>>
大数据入门:Zookeeper结构体系
查看>>
大数据入门:Spark RDD基础概念
查看>>
大数据入门:SparkCore开发调优原则
查看>>
大数据入门:Java和Scala编程对比
查看>>
大数据入门:Scala函数式编程
查看>>
【数据结构周周练】002顺序表与链表
查看>>
C++报错:C4700:使用了非初始化的局部变量
查看>>
【数据结构周周练】003顺序栈与链栈
查看>>
C++类、结构体、函数、变量等命名规则详解
查看>>
C++ goto语句详解
查看>>
【数据结构周周练】008 二叉树的链式创建及测试
查看>>
《软件体系结构》 第九章 软件体系结构评估
查看>>
《软件体系结构》 第十章 软件产品线体系结构
查看>>
《软件过程管理》 第六章 软件过程的项目管理
查看>>
《软件过程管理》 第九章 软件过程的评估和改进
查看>>
分治法 动态规划法 贪心法 回溯法 小结
查看>>
《软件体系结构》 练习题
查看>>
《数据库系统概论》 第一章 绪论
查看>>
《数据库系统概论》 第二章 关系数据库
查看>>