Skip to content

Commit

Permalink
Merge pull request tensorflow#1536 from awilliamson/alexnet_lrn
Browse files Browse the repository at this point in the history
Implemented LRN for AlexNet tutorial
  • Loading branch information
nealwu authored Jun 15, 2017
2 parents ea2f470 + 11733fc commit 35f6f9c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions tutorials/image/alexnet/alexnet_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,15 @@ def inference(images):
parameters += [kernel, biases]

# lrn1
# TODO(shlens, jiayq): Add a GPU version of local response normalization.
with tf.name_scope('lrn1') as scope:
lrn1 = tf.nn.local_response_normalization(conv1,
alpha=1e-4,
beta=0.75,
depth_radius=2,
bias=2.0)

# pool1
pool1 = tf.nn.max_pool(conv1,
pool1 = tf.nn.max_pool(lrn1,
ksize=[1, 3, 3, 1],
strides=[1, 2, 2, 1],
padding='VALID',
Expand All @@ -96,8 +101,16 @@ def inference(images):
parameters += [kernel, biases]
print_activations(conv2)

# lrn2
with tf.name_scope('lrn2') as scope:
lrn2 = tf.nn.local_response_normalization(conv2,
alpha=1e-4,
beta=0.75,
depth_radius=2,
bias=2.0)

# pool2
pool2 = tf.nn.max_pool(conv2,
pool2 = tf.nn.max_pool(lrn2,
ksize=[1, 3, 3, 1],
strides=[1, 2, 2, 1],
padding='VALID',
Expand Down

0 comments on commit 35f6f9c

Please sign in to comment.