Skip to content

Commit f91fb23

Browse files
Removed Bias Terms from L2 Loss
1 parent 83fcc47 commit f91fb23

File tree

4 files changed

+0
-8
lines changed

4 files changed

+0
-8
lines changed

cnn_fchollet.py

-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def __init__(self, sequence_length, num_classes, vocab_size, embedding_size, emb
7878
b = tf.Variable(tf.constant(0.1, shape=[num_units]), name="b")
7979

8080
l2_loss += tf.nn.l2_loss(W)
81-
l2_loss += tf.nn.l2_loss(b)
8281

8382
self.x = tf.nn.xw_plus_b(self.x, W, b)
8483
self.x = tf.nn.relu(self.x)
@@ -92,7 +91,6 @@ def __init__(self, sequence_length, num_classes, vocab_size, embedding_size, emb
9291
b = tf.Variable(tf.constant(0.1, shape=[num_classes]), name="b")
9392

9493
l2_loss += tf.nn.l2_loss(W)
95-
l2_loss += tf.nn.l2_loss(b)
9694

9795
self.scores = tf.nn.xw_plus_b(self.x, W, b, name="scores")
9896
self.predictions = tf.argmax(self.scores, 1, name="predictions")

cnn_ykim.py

-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def __init__(self, sequence_length, num_classes, vocab_size, embedding_size, emb
7272
b = tf.Variable(tf.constant(0.1, shape=[num_units]), name="b")
7373

7474
l2_loss += tf.nn.l2_loss(W)
75-
l2_loss += tf.nn.l2_loss(b)
7675

7776
self.x = tf.nn.xw_plus_b(self.x, W, b)
7877
self.x = tf.nn.relu(self.x)
@@ -86,7 +85,6 @@ def __init__(self, sequence_length, num_classes, vocab_size, embedding_size, emb
8685
b = tf.Variable(tf.constant(0.1, shape=[num_classes]), name="b")
8786

8887
l2_loss += tf.nn.l2_loss(W)
89-
l2_loss += tf.nn.l2_loss(b)
9088

9189
self.scores = tf.nn.xw_plus_b(self.x, W, b, name="scores")
9290
self.predictions = tf.argmax(self.scores, 1, name="predictions")

graph_cnn.py

-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def __init__(self, filter_name, L, K, F, P, FC, batch_size, num_vertices, num_cl
8989
b = tf.Variable(tf.constant(0.1, shape=[num_units]), name="b")
9090

9191
l2_loss += tf.nn.l2_loss(W)
92-
l2_loss += tf.nn.l2_loss(b)
9392

9493
x = tf.nn.xw_plus_b(x, W, b)
9594
x = tf.layers.batch_normalization(x, training=self.train_flag)
@@ -104,7 +103,6 @@ def __init__(self, filter_name, L, K, F, P, FC, batch_size, num_vertices, num_cl
104103
b = tf.Variable(tf.constant(0.1, shape=[num_classes]), name="b")
105104

106105
l2_loss += tf.nn.l2_loss(W)
107-
l2_loss += tf.nn.l2_loss(b)
108106

109107
self.scores = tf.nn.xw_plus_b(x, W, b, name="scores")
110108
self.predictions = tf.argmax(self.scores, 1, name="predictions")

mlp.py

-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def __init__(self, vocab_size, num_classes, layers, l2_reg_lambda):
2626
b = tf.Variable(tf.constant(0.1, shape=[num_units]), name="b")
2727

2828
l2_loss += tf.nn.l2_loss(W)
29-
l2_loss += tf.nn.l2_loss(b)
3029

3130
x = tf.nn.xw_plus_b(x, W, b)
3231
x = tf.nn.relu(x)
@@ -40,7 +39,6 @@ def __init__(self, vocab_size, num_classes, layers, l2_reg_lambda):
4039
b = tf.Variable(tf.constant(0.1, shape=[num_classes]), name="b")
4140

4241
l2_loss += tf.nn.l2_loss(W)
43-
l2_loss += tf.nn.l2_loss(b)
4442

4543
self.scores = tf.nn.xw_plus_b(x, W, b, name="scores")
4644
self.predictions = tf.argmax(self.scores, 1, name="predictions")

0 commit comments

Comments
 (0)