Skip to content

Commit

Permalink
pool2d
Browse files Browse the repository at this point in the history
  • Loading branch information
i-evi committed Jan 7, 2021
1 parent c579731 commit 900f5ae
Show file tree
Hide file tree
Showing 15 changed files with 494 additions and 512 deletions.
4 changes: 2 additions & 2 deletions demo/lenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ int main(int argc, const char *argv[])

l1 = cc_relu(l1, NULL);

l1_pool = cc_max_pool2d(l1, 2, "l1_pool");
l1_pool = cc_max_pool2d(l1, 2, 2, 0, 0, "l1_pool");

l2 = cc_conv2d(l1_pool, conv2_w, conv2_b, 1, 2, 0, "l2_conv");

l2 = cc_relu(l2, NULL);

l2_pool = cc_max_pool2d(l2, 2, "l2_pool");
l2_pool = cc_max_pool2d(l2, 2, 2, 0, 0, "l2_pool");

/* l2_flat = cc_fmap2d_flat(l2_pool, "l2_flat"); */
l2_flat = cc_reshape(l2_pool, shape_flat);
Expand Down
4 changes: 2 additions & 2 deletions demo/lua2vgg16.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ for i = 1, 2 do
features:append(fn.relu , { name = "#NULL"})
features:append(fn.conv2d , { input = nil, stride = 1, padding = 1 })
features:append(fn.relu , { name = "#NULL"})
features:append(fn.max_pool2d, { stride = 2 })
features:append(fn.max_pool2d, { kernel = 2, stride = 2 })
end

for i = 1, 3 do
Expand All @@ -31,7 +31,7 @@ for i = 1, 3 do
features:append(fn.relu , { name = "#NULL"})
features:append(fn.conv2d , { stride = 1, padding = 1 })
features:append(fn.relu , { name = "#NULL"})
features:append(fn.max_pool2d, { stride = 2 })
features:append(fn.max_pool2d, { kernel = 2, stride = 2 })
end

classifier:append(fn.reshape, { shape = { -1, 1, 1 } }) -- C * H * W
Expand Down
10 changes: 5 additions & 5 deletions demo/vgg16.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,33 +106,33 @@ void vgg16(cc_tensor_t *in, cc_tensor_t **out)
l2 = cc_relu(l1, NULL);
l3 = cc_conv2d(l2, __pls[2], __pls[3], 1, 1, 0, "vgg16/l3");
l4 = cc_relu(l3, NULL);
l5 = cc_max_pool2d(l4, 2, "vgg16/l5");
l5 = cc_max_pool2d(l4, 2, 2, 0, 0, "vgg16/l5");
l6 = cc_conv2d(l5, __pls[4], __pls[5], 1, 1, 0, "vgg16/l6");
l7 = cc_relu(l6, NULL);
l8 = cc_conv2d(l7, __pls[6], __pls[7], 1, 1, 0, "vgg16/l8");
l9 = cc_relu(l8, NULL);
l10 = cc_max_pool2d(l9, 2, "vgg16/l10");
l10 = cc_max_pool2d(l9, 2, 2, 0, 0, "vgg16/l10");
l11 = cc_conv2d(l10, __pls[8], __pls[9], 1, 1, 0, "vgg16/l11");
l12 = cc_relu(l11, NULL);
l13 = cc_conv2d(l12, __pls[10], __pls[11], 1, 1, 0, "vgg16/l13");
l14 = cc_relu(l13, NULL);
l15 = cc_conv2d(l14, __pls[12], __pls[13], 1, 1, 0, "vgg16/l15");
l16 = cc_relu(l15, NULL);
l17 = cc_max_pool2d(l16, 2, "vgg16/l17");
l17 = cc_max_pool2d(l16, 2, 2, 0, 0, "vgg16/l17");
l18 = cc_conv2d(l17, __pls[14], __pls[15], 1, 1, 0, "vgg16/l18");
l19 = cc_relu(l18, NULL);
l20 = cc_conv2d(l19, __pls[16], __pls[17], 1, 1, 0, "vgg16/l20");
l21 = cc_relu(l20, NULL);
l22 = cc_conv2d(l21, __pls[18], __pls[19], 1, 1, 0, "vgg16/l22");
l23 = cc_relu(l22, NULL);
l24 = cc_max_pool2d(l23, 2, "vgg16/l24");
l24 = cc_max_pool2d(l23, 2, 2, 0, 0, "vgg16/l24");
l25 = cc_conv2d(l24, __pls[20], __pls[21], 1, 1, 0, "vgg16/l25");
l26 = cc_relu(l25, NULL);
l27 = cc_conv2d(l26, __pls[22], __pls[23], 1, 1, 0, "vgg16/l27");
l28 = cc_relu(l27, NULL);
l29 = cc_conv2d(l28, __pls[24], __pls[25], 1, 1, 0, "vgg16/l29");
l30 = cc_relu(l29, NULL);
l31 = cc_max_pool2d(l30, 2, "vgg16/l31");
l31 = cc_max_pool2d(l30, 2, 2, 0, 0, "vgg16/l31");
l32 = cc_reshape(l31, __shape0);
l33 = cc_fully_connected(l32, __pls[26], __pls[27], "vgg16/l33");
l34 = cc_relu(l33, NULL);
Expand Down
Loading

0 comments on commit 900f5ae

Please sign in to comment.