Skip to content

Commit

Permalink
fix the implementation of WS (fix #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppwwyyxx committed Jun 28, 2019
1 parent 9726d7f commit 58f4903
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ImageNet-ResNet-TensorFlow/imagenet-resnet-gn.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def weight_standardization(v):
return v
if (not v.name.endswith('/W:0')) or v.shape.ndims != 4:
return v
mean, std = tf.nn.moments(v, [0, 1, 2], keep_dims=True)
v = (v - mean) / (std + 1e-5)
mean, var = tf.nn.moments(v, [0, 1, 2], keep_dims=True)
v = (v - mean) / (tf.sqrt(var)+ 1e-5)
return v

num_blocks = {50: [3, 4, 6, 3], 101: [3, 4, 23, 3]}[self.depth]
Expand Down

0 comments on commit 58f4903

Please sign in to comment.