tensorflow 中 name_scope和variable_scope
- import tensorflow as tf
- with tf.name_scope("hello") as name_scope:
- arr1 = tf.get_variable("arr1", shape=[2,10],dtype=tf.float32)
- print (name_scope)
- print (arr1.name)
- print ("scope_name:%s " % tf.get_variable_scope().original_name_scope)
运行后的结果如下:
hello/
arr1:0
scope_name:
- import tensorflow as tf
- with tf.name_scope('hidden') as scope:
- a = tf.constant(5, name='alpha')
- W = tf.Variable(tf.random_uniform([1, 2], -1.0, 1.0), name='weights')
- b = tf.Variable(tf.zeros([1]), name='biases')
- print (a.name)
- print (W.name)
- print (b.name)
运行的结果:
hidden/alpha:0
hidden/weights:0
hidden/biases:0
红色字体要强调的部分所以把字体改成了红色,理解name_scope 对 tf.get_variable()的作用和 tf.Variable()的不同
tensorflow 中 name_scope和variable_scope的更多相关文章
- tensorflow 中 name_scope 及 variable_scope 的异同
Let's begin by a short introduction to variable sharing. It is a mechanism in TensorFlow that allows ...
- tensorflow中使用tf.variable_scope和tf.get_variable的ValueError
ValueError: Variable conv1/weights1 already exists, disallowed. Did you mean to set reuse=True in Va ...
- Tensorflow中的name_scope和variable_scope
Tensorflow是一个编程模型,几乎成为了一种编程语言(里面有变量.有操作......). Tensorflow编程分为两个阶段:构图阶段+运行时. Tensorflow构图阶段其实就是在对图进行 ...
- TensorFlow学习笔记(1):variable与get_variable, name_scope()和variable_scope()
Variable tensorflow中有两个关于variable的op,tf.Variable()与tf.get_variable()下面介绍这两个的区别 使用tf.Variable时,如果检测到命 ...
- [翻译] Tensorflow中name scope和variable scope的区别是什么
翻译自:https://stackoverflow.com/questions/35919020/whats-the-difference-of-name-scope-and-a-variable-s ...
- TensorFlow中的变量命名以及命名空间.
What: 在Tensorflow中, 为了区别不同的变量(例如TensorBoard显示中), 会需要命名空间对不同的变量进行命名. 其中常用的两个函数为: tf.variable_scope, t ...
- tensorflow中slim模块api介绍
tensorflow中slim模块api介绍 翻译 2017年08月29日 20:13:35 http://blog.csdn.net/guvcolie/article/details/77686 ...
- name_scope与variable_scope 详解
版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/lucky7213/article/deta ...
- 第二十二节,TensorFlow中的图片分类模型库slim的使用、数据集处理
Google在TensorFlow1.0,之后推出了一个叫slim的库,TF-slim是TensorFlow的一个新的轻量级的高级API接口.这个模块是在16年新推出的,其主要目的是来做所谓的“代码瘦 ...
随机推荐
- 《Python编程从0到1》笔记5——图解递归你肯定看完就能懂!
本小节的示例比较简单,因为在每次递归过程中原问题仅缩减为单个更小的问题.这样的问题往往能够用简单循环解决.这类递归算法的函数调用图是链状结构.这种递归类型被称为“单重递归”(single recurs ...
- etcd集群添加节点
查看当前集群节点信息 # etcdctl member list --write-out=table +------------------+---------+------------------- ...
- [转帖]什么是 LLVM?Swift, Rust, Clang 等语言背后的支持
要了解用于以编程方式生成机器原生代码的编译器框架是如何让新语言的推出以及对现有的语言进行增强比以往更加容易了. https://www.oschina.net/translate/what-is-ll ...
- 刷机,twrp,安装xposed
首先明白几个名词: recovery模式,类似于pc端的PE系统,每个手机都有自带的rec,但不好用,最好自己刷一个,现在市面最好用的是twrp fastboot模式,比recovery更底层,进入f ...
- C++中的多重继承(一)
1,C++ 中是否允许一个类继承自多个父类? 1,可以: 2,这种情况就是多重继承: 3,多重继承的表象就是一个类有多个父类: 4,这是 C++ 非常特别的一个特性,在其他的程序设计语言中比如 C#. ...
- windows环境下搭建mysql主从
参考 windows环境下mysql主从配置 1. 环境 参数 说明 主库所在的操作系统 win7 主库的版本 mysql-5.6.46-winx64 主库的ip地址 127.0.0.1 主库的端口 ...
- 在linux下和Mac下如何实现快捷方式连接SSH远程服务器
其实特别简单 在本地命令执行目录/usr/local/bin 下新建一个shell脚本 比如 #vim ssh1 写入要执行的内容连接SSH #!/usr/bin/expect -f set user ...
- 部署 laravel项目404错误
1.nginx 下部署出现404错误 (1)打开php.ini中的php_openssl.dll这个扩展: (2)修改nginx 下的站点目录配置文件(我的是配置在vhost.conf)为: loca ...
- javascript伪链接(javascript:)
前言 我们经常会看到“javascript:”这种情况,他经常会用在两种属性身上,href和onclick等事件处理器,接下里我们主要说用在onclick等事件处理器上的情况,在href中的应用在之前 ...
- [Linux]Linux下经常会用到的简单实例(持续更新)
1.查找某些进程并结束他们: ps -elf | grep '进程关键字' | awk '{print $4}'| xargs kill -9 解析: ps -elf 的 -e 代表列出所有进程,-l ...