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
languages
CNNArchLang
Commits
074e4f3c
Commit
074e4f3c
authored
May 21, 2019
by
Sebastian Nickels
Browse files
Enable more in-depth generator-specific compability testing of architectures before generating them
parent
7aeb61ac
Pipeline
#142104
passed with stages
in 20 minutes and 21 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/cnnarch/CNNArchGenerator.java
View file @
074e4f3c
...
...
@@ -60,37 +60,18 @@ public abstract class CNNArchGenerator {
return
this
.
modelsDirPath
;
}
public
void
generate
(
Path
modelsDirPath
,
String
rootModelName
){
public
boolean
generate
(
Path
modelsDirPath
,
String
rootModelName
){
this
.
modelsDirPath
=
modelsDirPath
.
toString
();
final
ModelPath
mp
=
new
ModelPath
(
modelsDirPath
);
GlobalScope
scope
=
new
GlobalScope
(
mp
,
new
CNNArchLanguage
());
generate
(
scope
,
rootModelName
);
return
generate
(
scope
,
rootModelName
);
}
public
abstract
void
generate
(
Scope
scope
,
String
rootModelName
);
public
abstract
boolean
generate
(
Scope
scope
,
String
rootModelName
);
//check cocos with CNNArchCocos.checkAll(architecture) before calling this method.
public
abstract
Map
<
String
,
String
>
generateStrings
(
ArchitectureSymbol
architecture
);
public
void
checkValidGeneration
(
ArchitectureSymbol
architecture
){
if
(
architecture
.
getInputs
().
size
()
>
1
){
Log
.
error
(
"This cnn architecture has multiple inputs, "
+
"which is currently not supported by the code generator. "
,
architecture
.
getSourcePosition
());
}
if
(
architecture
.
getOutputs
().
size
()
>
1
){
Log
.
error
(
"This cnn architecture has multiple outputs, "
+
"which is currently not supported by the code generator. "
,
architecture
.
getSourcePosition
());
}
if
(
architecture
.
getOutputs
().
get
(
0
).
getDefinition
().
getType
().
getWidth
()
!=
1
||
architecture
.
getOutputs
().
get
(
0
).
getDefinition
().
getType
().
getHeight
()
!=
1
){
Log
.
error
(
"This cnn architecture has a multi-dimensional output, "
+
"which is currently not supported by the code generator."
,
architecture
.
getSourcePosition
());
}
}
//check cocos with CNNArchCocos.checkAll(architecture) before calling this method.
public
void
generateFiles
(
ArchitectureSymbol
architecture
)
throws
IOException
{
Map
<
String
,
String
>
fileContentMap
=
generateStrings
(
architecture
);
...
...
Write
Preview
Supports
Markdown
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