forked from gvtulder/morb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convolutions
81 lines (50 loc) · 2.29 KB
/
convolutions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
W + 0.001 * (conv(v, sigmoid(conv(v, W) + bh)) - conv(sigmoid(conv + bv), sigmoid(conv + bh)))
# conv input is (mb_size, input_maps, input height [numrows], input width [numcolumns])
# conv input is (output_maps, input_maps, filter height [numrows], filter width [numcolumns])
# conv output is (mb_size, output_maps, output height [numrows], output width [numcolumns])
self.W = W # (hidden_maps, visible_maps, filter_height, filter_width)
self.vu = units_list[0] # (mb_size, visible_maps, visible_height, visible_width)
self.hu = units_list[1] # (mb_size, hidden_maps, hidden_height, hidden_width)
hd = h0.dimshuffle(1,0,2,3)
conv(v0, hd)
v0: (mb_size, visible_maps, visible_height, visible_width)
h0: (mb_size, hidden_maps, visible_height - filter_height + 1, visible_width - filter_width + 1)
hd: (hidden_maps, mb_size, visible_height - filter_height + 1, visible_width - filter_width + 1)
conv INPUT 1 (inputs):
mb_size = mb_size
input_maps = visible_maps
input_height = visible_height
input_width = visible_width
conv INPUT 2 (filters):
output_maps = hidden_maps
input_maps = mb_size
filter_height = visible_height - filter_height + 1
filter_width = visible_width - filter_width + 1
conv OUTPUT (outputs):
mb_size = mb_size
output_maps = hidden_maps
output_height = filter_height
output_width = filter_width
DESIRED OUTPUT: (hidden_maps, visible_maps, filter_height, filter_width)
-------------
v0: (mb_size, visible_maps, visible_height, visible_width)
h0: (mb_size, hidden_maps, visible_height - filter_height + 1, visible_width - filter_width + 1)
vd: (visible_maps, mb_size, visible_height, visible_width)
hd: (hidden_maps, mb_size, visible_height - filter_height + 1, visible_width - filter_width + 1)
conv INPUT 1 (inputs): dimshuffle(1, 0, 2, 3)
mb_size = visible_maps
input_maps = mb_size
input_height = visible_height
input_width = visible_width
conv INPUT 2 (filters): dimshuffle(1, 0, 2, 3)
output_maps = hidden_maps
input_maps = mb_size
filter_height = visible_height - filter_height + 1
filter_width = visible_width - filter_width + 1
conv OUTPUT (outputs):
mb_size = visible_maps
output_maps = hidden_maps
output_height = filter_height
output_width = filter_width
en dan nog de output dimshuffle(1, 0, 2, 3) en we zijn er!
DESIRED OUTPUT: (hidden_maps, visible_maps, filter_height, filter_width)