吴裕雄 python 神经网络——TensorFlow 变量管理
import tensorflow as tf
with tf.variable_scope("foo"):
v = tf.get_variable("v", [1], initializer=tf.constant_initializer(1.0))
#with tf.variable_scope("foo"):
# v = tf.get_variable("v", [1])
with tf.variable_scope("foo", reuse=True):
v1 = tf.get_variable("v", [1])
print(v == v1)
#with tf.variable_scope("bar", reuse=True):
# v = tf.get_variable("v", [1])

with tf.variable_scope("root"):
print(tf.get_variable_scope().reuse)
with tf.variable_scope("foo", reuse=True):
print(tf.get_variable_scope().reuse)
with tf.variable_scope("bar"):
print(tf.get_variable_scope().reuse)
print(tf.get_variable_scope().reuse)

v1 = tf.get_variable("v", [1])
print(v1.name)
with tf.variable_scope("foo",reuse=True):
v2 = tf.get_variable("v", [1])
print(v2.name)
with tf.variable_scope("foo"):
with tf.variable_scope("bar"):
v3 = tf.get_variable("v", [1])
print(v3.name)
v4 = tf.get_variable("v1", [1])
print(v4.name)

with tf.variable_scope("",reuse=True):
v5 = tf.get_variable("foo/bar/v", [1])
print(v5 == v3)
v6 = tf.get_variable("v1", [1])
print(v6 == v4)

吴裕雄 python 神经网络——TensorFlow 变量管理的更多相关文章
- 吴裕雄 python 神经网络——TensorFlow实现搭建基础神经网络
import numpy as np import tensorflow as tf import matplotlib.pyplot as plt def add_layer(inputs, in_ ...
- 吴裕雄 python 神经网络——TensorFlow 使用卷积神经网络训练和预测MNIST手写数据集
import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_dat ...
- 吴裕雄 python 神经网络TensorFlow实现LeNet模型处理手写数字识别MNIST数据集
import tensorflow as tf tf.reset_default_graph() # 配置神经网络的参数 INPUT_NODE = 784 OUTPUT_NODE = 10 IMAGE ...
- 吴裕雄 python 神经网络——TensorFlow 数据集高层操作
import tempfile import tensorflow as tf train_files = tf.train.match_filenames_once("E:\\output ...
- 吴裕雄 python 神经网络——TensorFlow 花瓣分类与迁移学习(4)
# -*- coding: utf-8 -*- import glob import os.path import numpy as np import tensorflow as tf from t ...
- 吴裕雄 python 神经网络——TensorFlow 花瓣分类与迁移学习(3)
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platfor ...
- 吴裕雄 python 神经网络——TensorFlow 花瓣分类与迁移学习(2)
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platfor ...
- 吴裕雄 python 神经网络——TensorFlow 花瓣识别2
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platfor ...
- 吴裕雄 python 神经网络——TensorFlow 三层简单神经网络的前向传播算法
import tensorflow as tf w1= tf.Variable(tf.random_normal([2, 3], stddev=1, seed=1)) w2= tf.Variable( ...
随机推荐
- 2分钟就能学会的【Google/百度搜索大法】了解一下?
之前我在知乎回答了「日常生活中有哪些十分钟就能学会并可以终生受用的技能」,现在也整理分享给公众号的朋友们. 作为一个入坑8年国际贸易的老阿姨,真心推荐[google搜索大法](同样适用于百度). 2分 ...
- Apache Kafka(十一)Topic 的配置与组成
Topic 的配置与组成 之前我们仅主要介绍了Kafka Producer与Kafka Consumer 的相关配置,而未详细介绍过有关topic的配置.Topic的配置在Kafka 使用中也至关重要 ...
- 【PAT甲级】1114 Family Property (25分)(并查集)
题意: 输入一个正整数N(<=10000),接着输入N行每行包括一个人的ID和他双亲的ID以及他的孩子数量和孩子们的ID(四位整数包含前导零),还有他所拥有的房产数量和房产面积.输出一共有多少个 ...
- ACM的探索之Everything is Generated In Equal Probability! 后序补充丫!
Problem Desciption: 百度翻译后的汉化: 参见博客:https://www.cnblogs.com/zxcoder/p/11253099.html https://blog.csdn ...
- IDEA中进行远程调试springboot项目
1.以debug的模式启动Springboot项目 命令 java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8888,suspe ...
- linux 压测jmeter24h稳定性测试
环境准备: 安装jmeter,JDK: wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.1.tgz cd ...
- 有关C/C++中,表达式计算顺序的问题,以及表达式内部变量“副作用”问题(转)
经常可以在一些讨论组里看到下面的提问:“谁知道下面C语句给n赋什么值?”m = 1; n = m+++m++;最近有位不相识的朋友发email给我,问为什么在某个C++系统里,下面表达式打印出两个4, ...
- 1012 The Best Rank
1012 The Best Rank 1. 注意点 一名同学同样排名下的科目优先级问题 不同同学分数相同时排名相同,注意 排名不是 1 1 2 3 4 这种, 而是 1 1 3 4 5 注意到有些同学 ...
- 生成树计数模板 spoj 104 (不用逆元的模板)
/* 这种题,没理解,只是记一记如何做而已: 生成树的计数--Matrix-Tree定理 题目:SPOJ104(Highways) 题目大意: *一个有n座城市的组成国家,城市1至n编号,其中一些城市 ...
- java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [META-INF/services/com.alibaba.druid.filter.Filter].
九月 11, 2019 2:56:36 下午 org.apache.catalina.loader.WebappClassLoaderBase checkStateForResourceLoading ...