Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
CNNArch2MXNet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
monticore
EmbeddedMontiArc
generators
CNNArch2MXNet
Commits
e4eaa8c0
Commit
e4eaa8c0
authored
Feb 04, 2019
by
Evgeny Kusmenko
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'unsupported_layer_check' into 'master'
added layer support checker See merge request
!15
parents
cd6ac9aa
33b92579
Pipeline
#102420
failed with stages
in 4 minutes and 12 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
src/main/java/de/monticore/lang/monticar/cnnarch/mxnetgenerator/CNNArch2MxNet.java
...e/lang/monticar/cnnarch/mxnetgenerator/CNNArch2MxNet.java
+35
-0
src/main/java/de/monticore/lang/monticar/cnnarch/mxnetgenerator/LayerSupportChecker.java
.../monticar/cnnarch/mxnetgenerator/LayerSupportChecker.java
+20
-0
No files found.
src/main/java/de/monticore/lang/monticar/cnnarch/mxnetgenerator/CNNArch2MxNet.java
View file @
e4eaa8c0
...
...
@@ -24,6 +24,9 @@ import de.monticore.io.paths.ModelPath;
import
de.monticore.lang.monticar.cnnarch.CNNArchGenerator
;
import
de.monticore.lang.monticar.cnnarch._cocos.CNNArchCocos
;
import
de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureElementSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.CompositeElementSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.IOSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.CNNArchCompilationUnitSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.CNNArchLanguage
;
import
de.monticore.lang.monticar.generator.FileContent
;
...
...
@@ -39,11 +42,39 @@ import java.nio.file.Path;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.List
;
public
class
CNNArch2MxNet
implements
CNNArchGenerator
{
private
String
generationTargetPath
;
private
boolean
isSupportedLayer
(
ArchitectureElementSymbol
element
,
LayerSupportChecker
layerChecker
){
List
<
ArchitectureElementSymbol
>
constructLayerElemList
;
if
(!(
element
instanceof
IOSymbol
)
&&
(
element
.
getResolvedThis
().
get
()
instanceof
CompositeElementSymbol
))
{
constructLayerElemList
=
((
CompositeElementSymbol
)
element
.
getResolvedThis
().
get
()).
getElements
();
for
(
ArchitectureElementSymbol
constructedLayerElement
:
constructLayerElemList
)
{
if
(!
isSupportedLayer
(
constructedLayerElement
,
layerChecker
))
return
false
;
}
}
if
(!
layerChecker
.
isSupported
(
element
.
toString
()))
{
Log
.
error
(
"Unsupported layer "
+
"'"
+
element
.
getName
()
+
"'"
+
" for the backend MXNET."
);
return
false
;
}
else
{
return
true
;
}
}
private
boolean
supportCheck
(
ArchitectureSymbol
architecture
){
LayerSupportChecker
layerChecker
=
new
LayerSupportChecker
();
for
(
ArchitectureElementSymbol
element
:
((
CompositeElementSymbol
)
architecture
.
getBody
()).
getElements
()){
if
(!
isSupportedLayer
(
element
,
layerChecker
))
return
false
;
}
return
true
;
}
public
CNNArch2MxNet
()
{
setGenerationTargetPath
(
"./target/generated-sources-cnnarch/"
);
}
...
...
@@ -78,6 +109,10 @@ public class CNNArch2MxNet implements CNNArchGenerator {
}
CNNArchCocos
.
checkAll
(
compilationUnit
.
get
());
if
(!
supportCheck
(
compilationUnit
.
get
().
getArchitecture
())){
Log
.
error
(
"Code generation aborted."
);
System
.
exit
(
1
);
}
try
{
generateFiles
(
compilationUnit
.
get
().
getArchitecture
());
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/mxnetgenerator/LayerSupportChecker.java
0 → 100644
View file @
e4eaa8c0
package
de.monticore.lang.monticar.cnnarch.mxnetgenerator
;
import
static
de
.
monticore
.
lang
.
monticar
.
cnnarch
.
predefined
.
AllPredefinedLayers
.*;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
LayerSupportChecker
{
private
List
<
String
>
unsupportedLayerList
=
new
ArrayList
();
public
LayerSupportChecker
()
{
//Set the unsupported layers for the backend
//this.unsupportedLayerList.add(PREDEFINED_LAYER_NAME);
}
public
boolean
isSupported
(
String
element
)
{
return
!
this
.
unsupportedLayerList
.
contains
(
element
);
}
}
Write
Preview
Markdown
is supported
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