Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMADL2CPP
Commits
74cd8aa9
Commit
74cd8aa9
authored
Apr 24, 2019
by
Nicola Gatto
Browse files
Fix gluon generation test
parent
8e8d2bc3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/test/resources/target_code/gluon/CNNCreator_mnist_mnistClassifier_net.py
View file @
74cd8aa9
...
...
@@ -6,12 +6,15 @@ from CNNNet_mnist_mnistClassifier_net import Net
class
CNNCreator_mnist_mnistClassifier_net
:
_model_dir_
=
"model/mnist.LeNetNetwork/"
_model_prefix_
=
"model"
_input_shapes_
=
[(
1
,
28
,
28
)]
_input_shapes_
=
[(
1
,
28
,
28
,
)]
def
__init__
(
self
):
self
.
weight_initializer
=
mx
.
init
.
Normal
()
self
.
net
=
None
def
get_input_shapes
(
self
):
return
self
.
_input_shapes_
def
load
(
self
,
context
):
lastEpoch
=
0
param_file
=
None
...
...
src/test/resources/target_code/gluon/CNNPredictor_mnist_mnistClassifier_net.h
View file @
74cd8aa9
...
...
@@ -30,8 +30,7 @@ public:
void
predict
(
const
std
::
vector
<
float
>
&
image
,
std
::
vector
<
float
>
&
predictions
){
MXPredSetInput
(
handle
,
"data"
,
image
.
data
(),
image
.
size
());
//MXPredSetInput(handle, "image", image.data(), image.size());
MXPredSetInput
(
handle
,
"data"
,
image
.
data
(),
static_cast
<
mx_uint
>
(
image
.
size
()));
MXPredForward
(
handle
);
...
...
@@ -61,8 +60,6 @@ public:
int
dev_type
=
use_gpu
?
2
:
1
;
int
dev_id
=
0
;
handle
=
0
;
if
(
json_data
.
GetLength
()
==
0
||
param_data
.
GetLength
()
==
0
)
{
std
::
exit
(
-
1
);
...
...
@@ -70,10 +67,8 @@ public:
const
mx_uint
num_input_nodes
=
input_keys
.
size
();
const
char
*
input_keys_ptr
[
num_input_nodes
];
for
(
mx_uint
i
=
0
;
i
<
num_input_nodes
;
i
++
){
input_keys_ptr
[
i
]
=
input_keys
[
i
].
c_str
();
}
const
char
*
input_key
[
1
]
=
{
"data"
};
const
char
**
input_keys_ptr
=
input_key
;
mx_uint
shape_data_size
=
0
;
mx_uint
input_shape_indptr
[
input_shapes
.
size
()
+
1
];
...
...
@@ -92,8 +87,8 @@ public:
}
}
MXPredCreate
(
(
const
char
*
)
json_data
.
GetBuffer
(),
(
const
char
*
)
param_data
.
GetBuffer
(),
MXPredCreate
(
static_cast
<
const
char
*
>
(
json_data
.
GetBuffer
()
)
,
static_cast
<
const
char
*
>
(
param_data
.
GetBuffer
()
)
,
static_cast
<
size_t
>
(
param_data
.
GetLength
()),
dev_type
,
dev_id
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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