Skip to content

Commit 62bca23

Browse files
author
shixiaowen03
committed
noisy net
1 parent 48c04b3 commit 62bca23

File tree

5 files changed

+119
-94
lines changed

5 files changed

+119
-94
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/tensorflow1.2.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 55 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RL/Basic-NoisyNet-Demo/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ def f(e_list):
2222
inputs = tf.contrib.layers.flatten(inputs)
2323
flatten_shape = inputs.shape[1]
2424
weights = tf.get_variable('weights', shape=[flatten_shape, units], initializer=w_i)
25-
w_noise = tf.get_variable('w_noise', [flatten_shape, units], initializer=w_i, collections=c_names)
25+
w_sigma = tf.get_variable('w_sigma', [flatten_shape, units], initializer=w_i, collections=c_names)
2626
if noisy_distribution == 'independent':
27-
weights += tf.multiply(tf.random_normal(shape=w_noise.shape), w_noise)
27+
weights += tf.multiply(tf.random_normal(shape=w_sigma.shape), w_sigma)
2828
elif noisy_distribution == 'factorised':
2929
noise_1 = f(tf.random_normal(tf.TensorShape([flatten_shape, 1]), dtype=tf.float32)) # 注意是列向量形式,方便矩阵乘法
3030
noise_2 = f(tf.random_normal(tf.TensorShape([1, units]), dtype=tf.float32))
31-
weights += tf.multiply(noise_1 * noise_2, w_noise)
31+
weights += tf.multiply(noise_1 * noise_2, w_sigma)
3232
dense = tf.matmul(inputs, weights)
3333
if bias_shape is not None:
3434
assert bias_shape[0] == units

0 commit comments

Comments
 (0)