Last active
August 8, 2018 01:17
-
-
Save joeyism/b092bb2bbb17998c9bd565ed389bdcd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
image_size = 32 | |
input_images = tf.placeholder(tf.float32, | |
shape=[None, image_size, image_size, 3], | |
name="input_images") | |
# First CONV layer | |
kernel = tf.Variable(tf.truncated_normal([11, 11, 3, 96], | |
dtype=tf.float32, | |
stddev=1e-1), | |
name="conv1_weights") | |
conv = tf.nn.conv2d(input_images, kernel, [1, 4, 4, 1], padding="SAME") | |
bias = tf.Variable(tf.truncated_normal([96])) | |
conv_with_bias = tf.nn.bias_add(conv, bias) | |
conv1 = tf.nn.relu(conv_with_bias, name="conv1") | |
lrn1 = tf.nn.lrn(conv1, | |
alpha=1e-4, | |
beta=0.75, | |
depth_radius=2, | |
bias=2.0) | |
pooled_conv1 = tf.nn.max_pool(lrn1, | |
ksize=[1, 3, 3, 1], | |
strides=[1, 2, 2, 1], | |
padding="SAME", | |
name="pool1") | |
# Second CONV Layer | |
kernel = tf.Variable(tf.truncated_normal([5, 5, 96, 256], | |
dtype=tf.float32, | |
stddev=1e-1), | |
name="conv2_weights") | |
conv = tf.nn.conv2d(pooled_conv1, kernel, [1, 4, 4, 1], padding="SAME") | |
bias = tf.Variable(tf.truncated_normal([256]), name="conv2_bias") | |
conv_with_bias = tf.nn.bias_add(conv, bias) | |
conv2 = tf.nn.relu(conv_with_bias, name="conv2") | |
lrn2 = tf.nn.lrn(conv2, | |
alpha=1e-4, | |
beta=0.75, | |
depth_radius=2, | |
bias=2.0) | |
pooled_conv2 = tf.nn.max_pool(lrn2, | |
ksize=[1, 3, 3, 1], | |
strides=[1, 2, 2, 1], | |
padding="SAME", | |
name="pool2") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment