MCPcopy Create free account
hub / github.com/BVLC/caffe / lenet

Function lenet

python/caffe/test/test_net_spec.py:7–24  ·  view source on GitHub ↗
(batch_size)

Source from the content-addressed store, hash-verified

5from caffe import params as P
6
7def lenet(batch_size):
8 n = caffe.NetSpec()
9 n.data, n.label = L.DummyData(shape=[dict(dim=[batch_size, 1, 28, 28]),
10 dict(dim=[batch_size, 1, 1, 1])],
11 transform_param=dict(scale=1./255), ntop=2)
12 n.conv1 = L.Convolution(n.data, kernel_size=5, num_output=20,
13 weight_filler=dict(type='xavier'))
14 n.pool1 = L.Pooling(n.conv1, kernel_size=2, stride=2, pool=P.Pooling.MAX)
15 n.conv2 = L.Convolution(n.pool1, kernel_size=5, num_output=50,
16 weight_filler=dict(type='xavier'))
17 n.pool2 = L.Pooling(n.conv2, kernel_size=2, stride=2, pool=P.Pooling.MAX)
18 n.ip1 = L.InnerProduct(n.pool2, num_output=500,
19 weight_filler=dict(type='xavier'))
20 n.relu1 = L.ReLU(n.ip1, in_place=True)
21 n.ip2 = L.InnerProduct(n.relu1, num_output=10,
22 weight_filler=dict(type='xavier'))
23 n.loss = L.SoftmaxWithLoss(n.ip2, n.label)
24 return n.to_proto()
25
26def anon_lenet(batch_size):
27 data, label = L.DummyData(shape=[dict(dim=[batch_size, 1, 28, 28]),

Callers 1

test_lenetMethod · 0.85

Calls 1

to_protoMethod · 0.95

Tested by

no test coverage detected