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
b4ca5c24
Commit
b4ca5c24
authored
Aug 05, 2018
by
Carlos Alfredo Yeverino Rodriguez
Browse files
Inherit get-functions for Training parameters
parent
33f229d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
b4ca5c24
...
...
@@ -16,6 +16,7 @@
<!-- .. SE-Libraries .................................................. -->
<CNNArch.version>
0.2.2-SNAPSHOT
</CNNArch.version>
<CNNTrain.version>
0.2.2-SNAPSHOT
</CNNTrain.version>
<!-- .. Libraries .................................................. -->
<guava.version>
18.0
</guava.version>
...
...
@@ -70,6 +71,20 @@
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
cnn-train
</artifactId>
<version>
${CNNTrain.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
cnn-train
</artifactId>
<version>
${CNNTrain.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<!-- .. Test Libraries ............................................... -->
<dependency>
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/mxnetgenerator/ConfigurationData.java
View file @
b4ca5c24
...
...
@@ -26,26 +26,51 @@ public class ConfigurationData {
}
public
String
getNumEpoch
()
{
return
String
.
valueOf
(
getConfiguration
().
getNumEpoch
().
getValue
());
if
(!
getConfiguration
().
getEntryMap
().
containsKey
(
"num_epoch"
))
{
return
null
;
}
return
String
.
valueOf
(
getConfiguration
().
getEntry
(
"num_epoch"
).
getValue
());
}
public
String
getBatchSize
()
{
return
String
.
valueOf
(
getConfiguration
().
getBatchSize
().
getValue
());
if
(!
getConfiguration
().
getEntryMap
().
containsKey
(
"batch_size"
))
{
return
null
;
}
return
String
.
valueOf
(
getConfiguration
().
getEntry
(
"batch_size"
)
.
getValue
());
}
public
LoadCheckpointSymbol
getLoadCheckpoint
()
{
return
getConfiguration
().
getLoadCheckpoint
();
public
Boolean
getLoadCheckpoint
()
{
if
(!
getConfiguration
().
getEntryMap
().
containsKey
(
"load_checkpoint"
))
{
return
null
;
}
return
(
Boolean
)
getConfiguration
().
getEntry
(
"load_checkpoint"
).
getValue
().
getValue
();
}
public
NormalizeSymbol
getNormalize
()
{
return
getConfiguration
().
getNormalize
();
public
Boolean
getNormalize
()
{
if
(!
getConfiguration
().
getEntryMap
().
containsKey
(
"normalize"
))
{
return
null
;
}
return
(
Boolean
)
getConfiguration
().
getEntry
(
"normalize"
).
getValue
().
getValue
();
}
public
TrainContextSymbol
getContext
()
{
return
getConfiguration
().
getTrainContext
();
public
String
getContext
()
{
if
(!
getConfiguration
().
getEntryMap
().
containsKey
(
"context"
))
{
return
null
;
}
return
getConfiguration
().
getEntry
(
"context"
).
getValue
().
toString
();
}
public
String
getEvalMetric
()
{
if
(!
getConfiguration
().
getEntryMap
().
containsKey
(
"eval_metric"
))
{
return
null
;
}
return
getConfiguration
().
getEntry
(
"eval_metric"
).
getValue
().
toString
();
}
public
String
getOptimizerName
()
{
if
(
getConfiguration
().
getOptimizer
()
==
null
)
{
return
null
;
}
return
getConfiguration
().
getOptimizer
().
getName
();
}
...
...
src/main/resources/templates/mxnet/CNNTrainer.ftl
View file @
b4ca5c24
...
...
@@ -17,13 +17,13 @@ if __name__ == "__main__":
batch_size = $
{
config
.batchSize
}
,
</#
if
>
<#
if
(config.loadCheckpoint)??>
load_checkpoint = $
{
config
.loadCheckpoint
.value
?
string
(
"True"
,
"False"
)}
,
load_checkpoint = $
{
config
.loadCheckpoint
?
string
(
"True"
,
"False"
)}
,
</#
if
>
<#
if
(config.context)??>
context = '$
{
config
.context
.value
}
',
context = '$
{
config
.context
}
',
</#
if
>
<#
if
(config.normalize)??>
normalize = $
{
config
.normalize
.value
?
string
(
"True"
,
"False"
)}
,
normalize = $
{
config
.normalize
?
string
(
"True"
,
"False"
)}
,
</#
if
>
<#
if
(config.configuration.optimizer)??>
optimizer = '$
{
config
.optimizerName
}
',
...
...
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