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
CNNArch2Gluon
Commits
637fc715
Commit
637fc715
authored
Aug 23, 2019
by
Christian Fuß
Browse files
fixed naming Nets in CNNNET.ftl
parent
fba1a685
Pipeline
#175291
failed with stages
in 18 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/cnnarch/gluongenerator/CNNArch2GluonTemplateController.java
View file @
637fc715
...
...
@@ -109,9 +109,12 @@ public class CNNArch2GluonTemplateController extends CNNArchTemplateController {
include
(
unrollElement
.
getBody
().
getElements
().
get
(
0
).
getResolvedThis
().
get
(),
writer
,
netDefinitionMode
);
}
for
(
int
i
=
0
;
i
<
(
int
)
unrollElement
.
getIntValue
(
AllPredefinedLayers
.
BEAMSEARCH_MAX_LENGTH
).
get
();
i
++)
{
//System.err.println("TIME: " + unrollElement.getIntValue(AllPredefinedLayers.BEAMSEARCH_T_NAME).get());
int
timestep
=
0
;
//unrollElement.getIntValue(AllPredefinedLayers.BEAMSEARCH_T_NAME).get();
System
.
err
.
println
(
"i: "
+
i
);
while
(
timestep
<
unrollElement
.
getIntValue
(
AllPredefinedLayers
.
BEAMSEARCH_MAX_LENGTH
).
get
())
{
System
.
err
.
println
(
"i: "
+
timestep
);
for
(
ArchitectureElementSymbol
element
:
unrollElement
.
getBody
().
getElements
())
{
previousElement
=
getCurrentElement
();
...
...
@@ -126,6 +129,7 @@ public class CNNArch2GluonTemplateController extends CNNArchTemplateController {
}
}
}
timestep
++;
}
...
...
src/main/resources/templates/gluon/CNNNet.ftl
View file @
637fc715
...
...
@@ -96,23 +96,7 @@ ${tc.include(stream, "FORWARD_FUNCTION")}
<#
list
tc.architecture.unrolls as unroll>
<#
if
unroll.isTrainable()>
class
Net_$
{
unroll
?
index
}
(gluon.HybridBlock):
def __init__(self, data_mean=None, data_std=None,
**
kwargs):
super(Net_$
{
unroll
?
index
}
, self).__init__(
**
kwargs)
self.last_layers =
{}
with self.name_scope():
${
tc
.include
(
unroll
,
"ARCHITECTURE_DEFINITION")
}
def hybrid_forward(self, F, $
{
tc
.join
(
tc
.getUnrollInputNames
(
unroll
),
", "
)}
):
${
tc
.include
(
unroll
,
"FORWARD_FUNCTION")
}
return $
{
tc
.join
(
tc
.getUnrollOutputNames
(
unroll
),
", "
)}
</#
if
>
</#
list
>
<#
list
tc.architecture.unrolls as unroll>
<#
if
unroll.isTrainable()>
class
Net_$
{
unroll
?
index
}
(gluon.HybridBlock):
class
Net_$
{
tc
.architecture.streams
?
size
+
unroll
?
index
}
(gluon.HybridBlock):
def __init__(self, data_mean=None, data_std=None,
**
kwargs):
super(Net_$
{
unroll
?
index
}
, self).__init__(
**
kwargs)
self.last_layers =
{}
...
...
src/test/resources/valid_tests/RNNencdec.cnna
View file @
637fc715
architecture RNNencdec(max_length=5, vocabulary_size=30000, hidden_size=1000){
def input Q(0:1)^{vocabulary_size} source
def output Q(0:1)^{vocabulary_size} target
def output Q(0:1)^{vocabulary_size} target
[3]
timed <t> BeamSearchStart(max_length=5) {
source ->
source -> target[0];
timed <t=2> BeamSearchStart(max_length=5) {
target[t-1] ->
FullyConnected(units=vocabulary_size) ->
Softmax() ->
target
target
[t]
};
}
\ No newline at end of file
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