MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / tower_func

Function tower_func

examples/CaffeModels/load-alexnet.py:16–36  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

14
15
16def tower_func(image):
17 # img: 227x227x3
18 with argscope([Conv2D, FullyConnected], activation=tf.nn.relu):
19 l = Conv2D('conv1', image, filters=96, kernel_size=11, strides=4, padding='VALID')
20 l = tf.nn.lrn(l, 2, bias=1.0, alpha=2e-5, beta=0.75, name='norm1')
21 l = MaxPooling('pool1', l, 3, strides=2, padding='VALID')
22
23 l = Conv2D('conv2', l, filters=256, kernel_size=5, split=2)
24 l = tf.nn.lrn(l, 2, bias=1.0, alpha=2e-5, beta=0.75, name='norm2')
25 l = MaxPooling('pool2', l, 3, strides=2, padding='VALID')
26
27 l = Conv2D('conv3', l, filters=384, kernel_size=3)
28 l = Conv2D('conv4', l, filters=384, kernel_size=3, split=2)
29 l = Conv2D('conv5', l, filters=256, kernel_size=3, split=2)
30 l = MaxPooling('pool3', l, 3, strides=2, padding='VALID')
31
32 # This is just a script to load model, so we ignore the dropout layer
33 l = FullyConnected('fc6', l, 4096)
34 l = FullyConnected('fc7', l, 4096)
35 logits = FullyConnected('fc8', l, 1000)
36 tf.nn.softmax(logits, name='prob')
37
38
39def run_test(path, input):

Callers

nothing calls this directly

Calls 4

argscopeFunction · 0.85
Conv2DFunction · 0.85
MaxPoolingFunction · 0.85
FullyConnectedFunction · 0.85

Tested by

no test coverage detected