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 {
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);
if (!compilationUnit.isPresent()){
Log.error("could not resolve architecture " + rootModelName);
return false;
}
CNNArchCocos.checkAll(compilationUnit.get());
ArchitectureSymbol architecture = compilationUnit.get().getArchitecture();
if (!architectureSupportChecker.check(architecture)) {
return false;
}
if (!layerSupportChecker.check(architecture)) {
return false;
}
checkSupport(compilationUnit.get().getArchitecture());
try{
String confPath = getModelsDirPath() + "/data_paths.txt";
......@@ -83,19 +79,13 @@ public class CNNArch2MxNet extends CNNArchGenerator {
generateFiles(compilationUnit.get().getArchitecture());
} catch (IOException e){
Log.error(e.toString());
return false;
}
return true;
}
//check cocos with CNNArchCocos.checkAll(architecture) before calling this method.
public Map<String, String> generateStrings(ArchitectureSymbol architecture){
TemplateConfiguration templateConfiguration = new MxNetTemplateConfiguration();
Map<String, String> fileContentMap = new HashMap<>();
CNNArch2MxNetTemplateController archTc
= new CNNArch2MxNetTemplateController(architecture, templateConfiguration);
CNNArch2MxNetTemplateController archTc = new CNNArch2MxNetTemplateController(architecture);
Map.Entry<String, String> temp;
temp = archTc.process("CNNPredictor", Target.CPP);
......
......@@ -9,9 +9,8 @@ import java.io.Writer;
*/
public class CNNArch2MxNetTemplateController extends CNNArchTemplateController {
public CNNArch2MxNetTemplateController(ArchitectureSymbol architecture,
TemplateConfiguration templateConfiguration) {
super(architecture, templateConfiguration);
public CNNArch2MxNetTemplateController(ArchitectureSymbol architecture) {
super(architecture, new MxNetTemplateConfiguration());
}
public void include(IOSymbol ioElement, Writer writer){
......
......@@ -79,9 +79,6 @@ public class GenericCNNArchCli {
if (outputPath != null){
cnnArchGenerator.setGenerationTargetPath(outputPath);
}
if (!cnnArchGenerator.generate(modelsDirPath, rootModelName)) {
Log.error("Code generation failed");
}
cnnArchGenerator.generate(modelsDirPath, rootModelName);
}
}
\ No newline at end of file
......@@ -9,7 +9,6 @@ public class MxNetTemplateConfiguration extends TemplateConfiguration {
private static Configuration configuration;
public MxNetTemplateConfiguration() {
super();
if (configuration == null) {
configuration = super.createConfiguration();
}
......
......@@ -96,7 +96,7 @@ public class GenerationTest extends AbstractSymtabTest{
Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/architectures", "-r", "ThreeInputCNN_M14"};
CNNArch2MxNetCli.main(args);
assertTrue(Log.getFindings().size() == 2);
assertTrue(Log.getFindings().size() == 1);
}
@Test
......@@ -112,7 +112,7 @@ public class GenerationTest extends AbstractSymtabTest{
Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/invalid_tests", "-r", "MultipleStreams"};
CNNArch2MxNetCli.main(args);
assertTrue(Log.getFindings().size() == 2);
assertTrue(Log.getFindings().size() == 1);
}
@Test
......@@ -120,7 +120,7 @@ public class GenerationTest extends AbstractSymtabTest{
Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/invalid_tests", "-r", "MultipleOutputs"};
CNNArch2MxNetCli.main(args);
assertTrue(Log.getFindings().size() == 2);
assertTrue(Log.getFindings().size() == 3);
}
@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