Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
CNNArch2Caffe2
Commits
e053bc0c
Commit
e053bc0c
authored
Oct 18, 2018
by
Evgeny Kusmenko
Browse files
Merge branch 'fix_convolutionlayer_bug' into 'master'
Fix convolution layer bug See merge request
!7
parents
28de4da4
f1a3bcfd
Pipeline
#79181
passed with stages
in 5 minutes and 5 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/main/resources/templates/caffe2/elements/Convolution.ftl
View file @
e053bc0c
...
...
@@ -16,10 +16,6 @@
<#else>
<#assign kernelParameter = "kernel=[${kernelHeight},${kernelWidth}]">
</#if>
<#if input = tc.architectureInputs[0]> <#-- TODO: CHECK COMPARISON -->
${element.name} = brew.conv(model, ${input}, '${element.name}', dim_in=1, dim_out=${element.channels?c}, ${kernelParameter}, ${strideParameter})
<#else>
${element.name} = brew.conv(model, ${input}, '${element.name}', dim_in=${element.element.inputTypes[0].channels?c}, dim_out=${element.channels?c}, ${kernelParameter}, ${strideParameter})
</#if>
<#-- TODO: check how to adapt CNNArchLang argument no_bias=${element.noBias?string("True","False")} -->
<#include "OutputShape.ftl">
\ No newline at end of file
src/test/resources/target_code/CNNCreator_Alexnet.py
View file @
e053bc0c
...
...
@@ -58,8 +58,7 @@ class CNNCreator_Alexnet:
data
=
data
# data, output shape: {[3,224,224]}
conv1_
=
brew
.
conv
(
model
,
data
,
'conv1_'
,
dim_in
=
1
,
dim_out
=
96
,
kernel
=
11
,
stride
=
4
)
conv1_
=
brew
.
conv
(
model
,
data
,
'conv1_'
,
dim_in
=
3
,
dim_out
=
96
,
kernel
=
11
,
stride
=
4
)
# conv1_, output shape: {[96,55,55]}
lrn1_
=
mx
.
symbol
.
LRN
(
data
=
conv1_
,
alpha
=
0.0001
,
...
...
src/test/resources/target_code/CNNCreator_CifarClassifierNetwork.py
View file @
e053bc0c
...
...
@@ -58,8 +58,7 @@ class CNNCreator_CifarClassifierNetwork:
data
=
data
# data, output shape: {[3,32,32]}
conv2_1_
=
brew
.
conv
(
model
,
data
,
'conv2_1_'
,
dim_in
=
1
,
dim_out
=
8
,
kernel
=
3
,
stride
=
1
)
conv2_1_
=
brew
.
conv
(
model
,
data
,
'conv2_1_'
,
dim_in
=
3
,
dim_out
=
8
,
kernel
=
3
,
stride
=
1
)
# conv2_1_, output shape: {[8,32,32]}
batchnorm2_1_
=
mx
.
symbol
.
BatchNorm
(
data
=
conv2_1_
,
fix_gamma
=
True
,
...
...
@@ -70,8 +69,7 @@ class CNNCreator_CifarClassifierNetwork:
batchnorm3_1_
=
mx
.
symbol
.
BatchNorm
(
data
=
conv3_1_
,
fix_gamma
=
True
,
name
=
"batchnorm3_1_"
)
conv2_2_
=
brew
.
conv
(
model
,
data
,
'conv2_2_'
,
dim_in
=
1
,
dim_out
=
8
,
kernel
=
1
,
stride
=
1
)
conv2_2_
=
brew
.
conv
(
model
,
data
,
'conv2_2_'
,
dim_in
=
3
,
dim_out
=
8
,
kernel
=
1
,
stride
=
1
)
# conv2_2_, output shape: {[8,32,32]}
batchnorm2_2_
=
mx
.
symbol
.
BatchNorm
(
data
=
conv2_2_
,
fix_gamma
=
True
,
...
...
src/test/resources/target_code/CNNCreator_VGG16.py
View file @
e053bc0c
...
...
@@ -58,8 +58,7 @@ class CNNCreator_VGG16:
data
=
data
# data, output shape: {[3,224,224]}
conv1_
=
brew
.
conv
(
model
,
data
,
'conv1_'
,
dim_in
=
1
,
dim_out
=
64
,
kernel
=
3
,
stride
=
1
)
conv1_
=
brew
.
conv
(
model
,
data
,
'conv1_'
,
dim_in
=
3
,
dim_out
=
64
,
kernel
=
3
,
stride
=
1
)
# conv1_, output shape: {[64,224,224]}
relu1_
=
brew
.
relu
(
model
,
conv1_
,
conv1_
)
conv2_
=
brew
.
conv
(
model
,
relu1_
,
'conv2_'
,
dim_in
=
64
,
dim_out
=
64
,
kernel
=
3
,
stride
=
1
)
...
...
src/test/resources/valid_tests/LeNet.cnna
View file @
e053bc0c
architecture LeNet(img_height=28, img_width=28, img_channels=
3
, classes=10){
architecture LeNet(img_height=28, img_width=28, img_channels=
1
, classes=10){
def input Z(0:255)^{img_channels, img_height, img_width} image
def output Q(0:1)^{classes} predictions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment