吴裕雄 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( ...
随机推荐
- Jenkins - 基于 Docker 的 Jenkins 安装
概述 安装 Jenkins 基于 Docker 这个有点 水一发 的性质... 场景 学习 Jenkins 第一步, 当然是安装 但是 安装的方法 很多 Jenkins 是基于 Java 的 所以是个 ...
- [AGC027A]Candy Distribution Again
Description AGC027A 你有一些糖果,你要把这些糖果一个不剩分给一些熊孩子,但是这帮熊孩子只要特定数目的糖果,否则就会不开心,求最多的开心人数. Solution 如果\(\sum a ...
- pocketsphinx实现连续大词汇量语音识别
之前有个项目需求是要在客户内网实现一个连续大词汇语音识别功能,由于客户的内网是独立的,不能访问互联网,所以我只能到开源社区去找找碰碰运气了.后来在网上找到了cmusphinx(地址:http://cm ...
- Tex 一些命令
1. [!htp] 可以使这个内容跟随在前面的内容后面 假如前面是一段文字,后面是一幅图像,不知什么原因跑到其他地方去了.这时加个[!htp]可以使他紧紧跟在后面 ergdsgagdfgdfgfgaf ...
- 集合的操作 contains(),containsAll() ,addAll(),removeAll(),
package seday11; import java.util.ArrayList;import java.util.Collection;import java.util.HashSet;/** ...
- Object 反射 List
public static object DeserializeModel<T>(object dataModel) { Type type = typeof(T); Object ent ...
- gcc 简单使用笔记
编译生成可执行文件(bin文件): gcc test.c //默认生成可执行文件名为a.out 指定可执行文件名: gcc -o test test.c 编译生成目标文件(.o文件): gcc -c ...
- jmeter的BeanShell Sampler使用--导入第三方jar包
实现目的 测试接口的过程中,可能有时需要用到第三方jar包来生成一些测试数据,此时我们就可以通过BeanShell来调用自己编写的工具类,来对jmeter的功能进行扩展,以满足测试需要. 脚本实现 在 ...
- Python环境搭建后,多种方式的使用进行程序的执行。
Python环境搭建后,可以使用多种方式进行程序的执行. 第一种: 进入CMD命令提示符 输入python 进入python环境(可以使用Ctrl+C退出) 输入print("hello&q ...
- 初识HttpRunner
一.背景 前段时间接触到HttpRunner自动化测试框架,发现对测试人员代码能力要求极低,用户只需准备好用例脚本即可发起测试,非常方便,故记录一下. 二.安装 运行环境 HttpRunner框架基于 ...