Aufgrund einer Konfigurationsänderung wird die GitLab Registry ab 10 Uhr nur Read Only zur Verfügung stehen. / Due to a configuration change, the GitLab Registry will be available for read-only access from 10am.

Commit 8ba62ba2 authored by Sebastian Nickels's avatar Sebastian Nickels

Small changes so that architecture support can be checked in EMADL2CPP

parent 21269adf
Pipeline #144201 failed with stages
in 3 minutes and 26 seconds
...@@ -55,24 +55,20 @@ public class CNNArch2MxNet extends CNNArchGenerator { ...@@ -55,24 +55,20 @@ public class CNNArch2MxNet extends CNNArchGenerator {
setGenerationTargetPath("./target/generated-sources-cnnarch/"); setGenerationTargetPath("./target/generated-sources-cnnarch/");
} }
public boolean generate(Scope scope, String rootModelName) { public void checkSupport(ArchitectureSymbol architecture) {
architectureSupportChecker.check(architecture);
layerSupportChecker.check(architecture);
}
public void generate(Scope scope, String rootModelName) {
Optional<CNNArchCompilationUnitSymbol> compilationUnit = scope.resolve(rootModelName, CNNArchCompilationUnitSymbol.KIND); Optional<CNNArchCompilationUnitSymbol> compilationUnit = scope.resolve(rootModelName, CNNArchCompilationUnitSymbol.KIND);
if (!compilationUnit.isPresent()){ if (!compilationUnit.isPresent()){
Log.error("could not resolve architecture " + rootModelName); Log.error("could not resolve architecture " + rootModelName);
return false;
} }
CNNArchCocos.checkAll(compilationUnit.get()); CNNArchCocos.checkAll(compilationUnit.get());
ArchitectureSymbol architecture = compilationUnit.get().getArchitecture(); checkSupport(compilationUnit.get().getArchitecture());
if (!architectureSupportChecker.check(architecture)) {
return false;
}
if (!layerSupportChecker.check(architecture)) {
return false;
}
try{ try{
String confPath = getModelsDirPath() + "/data_paths.txt"; String confPath = getModelsDirPath() + "/data_paths.txt";
...@@ -83,19 +79,13 @@ public class CNNArch2MxNet extends CNNArchGenerator { ...@@ -83,19 +79,13 @@ public class CNNArch2MxNet extends CNNArchGenerator {
generateFiles(compilationUnit.get().getArchitecture()); generateFiles(compilationUnit.get().getArchitecture());
} catch (IOException e){ } catch (IOException e){
Log.error(e.toString()); Log.error(e.toString());
return false;
} }
return true;
} }
//check cocos with CNNArchCocos.checkAll(architecture) before calling this method. //check cocos with CNNArchCocos.checkAll(architecture) before calling this method.
public Map<String, String> generateStrings(ArchitectureSymbol architecture){ public Map<String, String> generateStrings(ArchitectureSymbol architecture){
TemplateConfiguration templateConfiguration = new MxNetTemplateConfiguration();
Map<String, String> fileContentMap = new HashMap<>(); Map<String, String> fileContentMap = new HashMap<>();
CNNArch2MxNetTemplateController archTc CNNArch2MxNetTemplateController archTc = new CNNArch2MxNetTemplateController(architecture);
= new CNNArch2MxNetTemplateController(architecture, templateConfiguration);
Map.Entry<String, String> temp; Map.Entry<String, String> temp;
temp = archTc.process("CNNPredictor", Target.CPP); temp = archTc.process("CNNPredictor", Target.CPP);
......
...@@ -9,9 +9,8 @@ import java.io.Writer; ...@@ -9,9 +9,8 @@ import java.io.Writer;
*/ */
public class CNNArch2MxNetTemplateController extends CNNArchTemplateController { public class CNNArch2MxNetTemplateController extends CNNArchTemplateController {
public CNNArch2MxNetTemplateController(ArchitectureSymbol architecture, public CNNArch2MxNetTemplateController(ArchitectureSymbol architecture) {
TemplateConfiguration templateConfiguration) { super(architecture, new MxNetTemplateConfiguration());
super(architecture, templateConfiguration);
} }
public void include(IOSymbol ioElement, Writer writer){ public void include(IOSymbol ioElement, Writer writer){
......
...@@ -79,9 +79,6 @@ public class GenericCNNArchCli { ...@@ -79,9 +79,6 @@ public class GenericCNNArchCli {
if (outputPath != null){ if (outputPath != null){
cnnArchGenerator.setGenerationTargetPath(outputPath); cnnArchGenerator.setGenerationTargetPath(outputPath);
} }
cnnArchGenerator.generate(modelsDirPath, rootModelName);
if (!cnnArchGenerator.generate(modelsDirPath, rootModelName)) {
Log.error("Code generation failed");
}
} }
} }
\ No newline at end of file
...@@ -9,7 +9,6 @@ public class MxNetTemplateConfiguration extends TemplateConfiguration { ...@@ -9,7 +9,6 @@ public class MxNetTemplateConfiguration extends TemplateConfiguration {
private static Configuration configuration; private static Configuration configuration;
public MxNetTemplateConfiguration() { public MxNetTemplateConfiguration() {
super();
if (configuration == null) { if (configuration == null) {
configuration = super.createConfiguration(); configuration = super.createConfiguration();
} }
......
...@@ -96,7 +96,7 @@ public class GenerationTest extends AbstractSymtabTest{ ...@@ -96,7 +96,7 @@ public class GenerationTest extends AbstractSymtabTest{
Log.getFindings().clear(); Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/architectures", "-r", "ThreeInputCNN_M14"}; String[] args = {"-m", "src/test/resources/architectures", "-r", "ThreeInputCNN_M14"};
CNNArch2MxNetCli.main(args); CNNArch2MxNetCli.main(args);
assertTrue(Log.getFindings().size() == 2); assertTrue(Log.getFindings().size() == 1);
} }
@Test @Test
...@@ -112,7 +112,7 @@ public class GenerationTest extends AbstractSymtabTest{ ...@@ -112,7 +112,7 @@ public class GenerationTest extends AbstractSymtabTest{
Log.getFindings().clear(); Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/invalid_tests", "-r", "MultipleStreams"}; String[] args = {"-m", "src/test/resources/invalid_tests", "-r", "MultipleStreams"};
CNNArch2MxNetCli.main(args); CNNArch2MxNetCli.main(args);
assertTrue(Log.getFindings().size() == 2); assertTrue(Log.getFindings().size() == 1);
} }
@Test @Test
...@@ -120,7 +120,7 @@ public class GenerationTest extends AbstractSymtabTest{ ...@@ -120,7 +120,7 @@ public class GenerationTest extends AbstractSymtabTest{
Log.getFindings().clear(); Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/invalid_tests", "-r", "MultipleOutputs"}; String[] args = {"-m", "src/test/resources/invalid_tests", "-r", "MultipleOutputs"};
CNNArch2MxNetCli.main(args); CNNArch2MxNetCli.main(args);
assertTrue(Log.getFindings().size() == 2); assertTrue(Log.getFindings().size() == 3);
} }
@Test @Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment