Commit bbb95cbf authored by Sebastian Nickels's avatar Sebastian Nickels
Browse files

Enable more in-depth generator-specific compability testing of architectures before generating them

parent b7f790a0
Pipeline #142106 failed with stages
in 3 minutes and 6 seconds
......@@ -31,6 +31,13 @@ import java.util.Map;
public class CNNArch2Gluon extends CNNArch2MxNet {
public CNNArch2Gluon() {
super();
architectureSupportChecker = new CNNArch2GluonArchitectureSupportChecker();
layerSupportChecker = new CNNArch2GluonLayerSupportChecker();
}
//check cocos with CNNArchCocos.checkAll(architecture) before calling this method.
@Override
public Map<String, String> generateStrings(ArchitectureSymbol architecture){
......@@ -61,8 +68,6 @@ public class CNNArch2Gluon extends CNNArch2MxNet {
temp = archTc.process("CNNBufferFile", Target.CPP);
fileContentMap.put("CNNBufferFile.h", temp.getValue());
checkValidGeneration(architecture);
return fileContentMap;
}
}
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
import de.monticore.lang.monticar.cnnarch.mxnetgenerator.ArchitectureSupportChecker;
public class CNNArch2GluonArchitectureSupportChecker extends ArchitectureSupportChecker {
public CNNArch2GluonArchitectureSupportChecker() {}
/*protected boolean checkMultipleStreams(ArchitectureSymbol architecture) {
return true;
}*/
/*protected boolean checkMultipleInputs(ArchitectureSymbol architecture) {
return true;
}*/
/*protected boolean checkMultipleOutputs(ArchitectureSymbol architecture) {
return true;
}*/
}
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedLayers;
import de.monticore.lang.monticar.cnnarch.mxnetgenerator.LayerSupportChecker;
public class CNNArch2GluonLayerSupportChecker extends LayerSupportChecker {
public CNNArch2GluonLayerSupportChecker() {
supportedLayerList.add(AllPredefinedLayers.FULLY_CONNECTED_NAME);
supportedLayerList.add(AllPredefinedLayers.CONVOLUTION_NAME);
supportedLayerList.add(AllPredefinedLayers.SOFTMAX_NAME);
supportedLayerList.add(AllPredefinedLayers.SIGMOID_NAME);
supportedLayerList.add(AllPredefinedLayers.TANH_NAME);
supportedLayerList.add(AllPredefinedLayers.RELU_NAME);
supportedLayerList.add(AllPredefinedLayers.DROPOUT_NAME);
supportedLayerList.add(AllPredefinedLayers.POOLING_NAME);
supportedLayerList.add(AllPredefinedLayers.GLOBAL_POOLING_NAME);
supportedLayerList.add(AllPredefinedLayers.LRN_NAME);
supportedLayerList.add(AllPredefinedLayers.BATCHNORM_NAME);
supportedLayerList.add(AllPredefinedLayers.SPLIT_NAME);
supportedLayerList.add(AllPredefinedLayers.GET_NAME);
supportedLayerList.add(AllPredefinedLayers.ADD_NAME);
supportedLayerList.add(AllPredefinedLayers.CONCATENATE_NAME);
supportedLayerList.add(AllPredefinedLayers.FLATTEN_NAME);
}
}
......@@ -103,13 +103,12 @@ public class GenerationTest extends AbstractSymtabTest {
"execute_VGG16"));
}
@Test
public void testThreeInputCNNGeneration() throws IOException, TemplateException {
Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/architectures", "-r", "ThreeInputCNN_M14"};
CNNArch2GluonCli.main(args);
assertTrue(Log.getFindings().size() == 1);
assertTrue(Log.getFindings().size() == 2);
}
@Test
......@@ -123,20 +122,18 @@ public class GenerationTest extends AbstractSymtabTest {
@Test
public void testMultipleOutputs() throws IOException, TemplateException {
Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/valid_tests", "-r", "MultipleOutputs"};
String[] args = {"-m", "src/test/resources/invalid_tests", "-r", "MultipleOutputs"};
CNNArch2GluonCli.main(args);
assertTrue(Log.getFindings().size() == 3);
assertTrue(Log.getFindings().size() == 2);
}
/* TODO: Uncomment when multiple streams are implemented
@Test
public void testMultipleStreams() throws IOException, TemplateException {
Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/valid_tests", "-r", "MultipleStreams"};
String[] args = {"-m", "src/test/resources/invalid_tests", "-r", "MultipleStreams"};
CNNArch2GluonCli.main(args);
assertTrue(Log.getFindings().size() == 3);
assertTrue(Log.getFindings().size() == 2);
}
*/
@Test
public void testFullCfgGeneration() throws IOException, TemplateException {
......@@ -212,7 +209,6 @@ public class GenerationTest extends AbstractSymtabTest {
);
}
@Test
public void testCMakeGeneration() {
Log.getFindings().clear();
......
......@@ -50,4 +50,5 @@ public class IntegrationPythonWrapperTest extends AbstractSymtabTest{
);
assertTrue(Paths.get("./target/generated-sources-cnnarch/reward/pylib").toFile().isDirectory());
}
}
MultipleStreams data/MultipleStreams
MultipleOutputs data/MultipleOutputs
\ No newline at end of file
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