MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / convpool

Function convpool

cnn_class/cnn_theano.py:28–43  ·  view source on GitHub ↗
(X, W, b, poolsize=(2, 2))

Source from the content-addressed store, hash-verified

26
27
28def convpool(X, W, b, poolsize=(2, 2)):
29 conv_out = conv2d(input=X, filters=W)
30
31 # downsample each feature map individually, using maxpooling
32 pooled_out = pool.pool_2d(
33 input=conv_out,
34 ws=poolsize,
35 ignore_border=True
36 )
37
38 # add the bias term. Since the bias is a vector (1D array), we first
39 # reshape it to a tensor of shape (1, n_filters, 1, 1). Each bias will
40 # thus be broadcasted across mini-batches and feature map
41 # width & height
42 # return T.tanh(pooled_out + b.dimshuffle('x', 0, 'x', 'x'))
43 return relu(pooled_out + b.dimshuffle('x', 0, 'x', 'x'))
44
45
46def init_filter(shape, poolsz):

Callers 2

mainFunction · 0.90
mainFunction · 0.70

Calls 1

reluFunction · 0.70

Tested by

no test coverage detected