Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CNNArch2Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
monticore
EmbeddedMontiArc
generators
CNNArch2Gluon
Commits
c2f2d411
Commit
c2f2d411
authored
5 years ago
by
Christian Fuß
Browse files
Options
Downloads
Patches
Plain Diff
fixed bug leading to multiple equivalent architecture outputs for unrolls
parent
f4ecf597
No related branches found
Branches containing commit
No related tags found
1 merge request
!23
Added Unroll-related features and layers
Pipeline
#178367
failed
5 years ago
Stage: windows
Stage: linux
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/resources/templates/gluon/CNNPredictor.ftl
+15
-13
15 additions, 13 deletions
src/main/resources/templates/gluon/CNNPredictor.ftl
src/main/resources/templates/gluon/execute.ftl
+2
-1
2 additions, 1 deletion
src/main/resources/templates/gluon/execute.ftl
with
17 additions
and
14 deletions
src/main/resources/templates/gluon/CNNPredictor.ftl
+
15
−
13
View file @
c2f2d411
...
...
@@ -117,34 +117,35 @@ public:
</#
list
>
<#
list
tc.architecture.unrolls as unroll>
<#
if
unroll.isTrainable()>
class
$
{
tc
.fileNameWithoutEnding
}
_$
{
unroll
?
index
}{
<#
list
unroll.getBodiesForAllTimesteps() as body>
<#
if
body.isTrainable()>
class
$
{
tc
.fileNameWithoutEnding
}
_$
{
tc
.architecture.streams
?
size
+
body
?
index
}{
public
:
const
std
::
string
json_file
=
"model/${tc.componentName}/model_${
unroll
?index}_newest-symbol.json"
;
const
std
::
string
param_file
=
"model/${tc.componentName}/model_${
unroll
?index}_newest-0000.params"
;
const
std
::
string
json_file
=
"model/${tc.componentName}/model_${
tc.architecture.streams?size + body
?index}_newest-symbol.json"
;
const
std
::
string
param_file
=
"model/${tc.componentName}/model_${
tc.architecture.streams?size + body
?index}_newest-0000.params"
;
const
std
::
vector
<
std
::
string
>
input_keys
=
{
<#
if
tc
.get
Unroll
InputNames
(
unroll
)
?
size
==
1
>
<#
if
tc
.get
Stream
InputNames
(
body
)
?
size
==
1
>
"data"
<#
else
>
<#
list
tc
.get
Unroll
InputNames
(
unroll
)
as
variable
>
"data${variable?index}"
<#
sep
>
,
</#
list
>
<#
list
tc
.get
Stream
InputNames
(
body
)
as
variable
>
"data${variable?index}"
<#
sep
>
,
</#
list
>
</#
if
>
}
;
const
std
::
vector
<
std
::
vector
<
mx_uint
>>
input_shapes
=
{
<#
list
tc
.get
Unroll
InputDimensions
(
unroll
)
as
dimensions
>
{
$
{
tc
.join
(
dimensions
,
", "
)}}
<#
sep
>
,
</#
list
>
}
;
const
std
::
vector
<
std
::
vector
<
mx_uint
>>
input_shapes
=
{
<#
list
tc
.get
Stream
InputDimensions
(
body
)
as
dimensions
>
{
$
{
tc
.join
(
dimensions
,
", "
)}}
<#
sep
>
,
</#
list
>
}
;
const
bool
use_gpu
=
false
;
P
redictorHandle
handle
;
explicit
$
{
tc
.fileNameWithoutEnding
}
_$
{
unroll
?
index
}(){
explicit
$
{
tc
.fileNameWithoutEnding
}
_$
{
tc
.architecture.streams
?
size
+
body
?
index
}(){
init
(
json_file
,
param_file
,
input_keys
,
input_shapes
,
use_gpu
)
;
}
~$
{
tc
.fileNameWithoutEnding
}
_$
{
unroll
?
index
}(){
~$
{
tc
.fileNameWithoutEnding
}
_$
{
tc
.architecture.streams
?
size
+
body
?
index
}(){
if
(
handle
)
MXP
redFree
(
handle
)
;
}
void
predict
(
$
{
tc
.join
(
tc
.get
Unroll
InputNames
(
unroll
),
", "
,
"const std::vector<float> &in_"
,
""
)},
$
{
tc
.join
(
tc
.get
Unroll
OutputNames
(
unroll
),
", "
,
"std::vector<float> &out_"
,
""
)}){
<#
list
tc
.get
Unroll
InputNames
(
unroll
)
as
variable
>
void
predict
(
$
{
tc
.join
(
tc
.get
Stream
InputNames
(
body
),
", "
,
"const std::vector<float> &in_"
,
""
)},
$
{
tc
.join
(
tc
.get
Stream
OutputNames
(
body
),
", "
,
"std::vector<float> &out_"
,
""
)}){
<#
list
tc
.get
Stream
InputNames
(
body
)
as
variable
>
MXP
redSetInput
(
handle
,
input_keys
[$
{
variable
?
index
}
]
.c_str
(),
in_
$
{
variable
}
.data
(),
static_cast
<
mx_uint
>
(
in_
$
{
variable
}
.size
()))
;
</#
list
>
...
...
@@ -155,7 +156,7 @@ public:
mx_uint
shape_len
;
size_t
size
;
<#
list
tc
.get
Unroll
OutputNames
(
unroll
)
as
variable
>
<#
list
tc
.get
Stream
OutputNames
(
body
)
as
variable
>
output_index
=
$
{
variable
?
index
?
c
}
;
MXP
redGetOutputShape
(
handle
,
output_index
,
&
shape
,
&
shape_len
)
;
size
=
1
;
...
...
@@ -222,6 +223,7 @@ public:
}
;
</#
if
>
</#
list
>
</#
list
>
#
endif
// $
{
tc
.fileNameWithoutEnding
?
upper_case
}
This diff is collapsed.
Click to expand it.
src/main/resources/templates/gluon/execute.ftl
+
2
−
1
View file @
c2f2d411
...
...
@@ -6,7 +6,8 @@
<#
list
tc.getLayerVariableMembers("1")?keys as member>
vector<float> $
{
member
}
($
{
tc
.join
(
tc
.getLayerVariableMembers
(
"1"
)[
member
]
, "
*
")
}
)
</#
list
>
<#
list
tc.architecture.outputs as output>
<#
list
tc.getNoDuplicateArchitectureOutputs() as output>
<#
if
tc.getName(output)??>
vector<float> $
{
tc
.getName
(
output
)}
($
{
tc
.join
(
output
.ioDeclaration.type.dimensions
,
" * "
)}
);
</#
if
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment