fixes for cnnarc2x changes

parent 84864d73
Pipeline #348719 failed with stage
in 2 minutes and 8 seconds
......@@ -17,13 +17,13 @@
<!-- .. SE-Libraries .................................................. -->
<emadl.version>0.2.12-SNAPSHOT</emadl.version>
<CNNTrain.version>0.3.12-SNAPSHOT</CNNTrain.version>
<cnnarch-generator.version>0.0.7-SNAPSHOT</cnnarch-generator.version>
<CNNTrain.version>0.4.0-SNAPSHOT</CNNTrain.version>
<cnnarch-generator.version>0.4.0-SNAPSHOT</cnnarch-generator.version>
<cnnarch-mxnet-generator.version>0.2.17-SNAPSHOT</cnnarch-mxnet-generator.version>
<cnnarch-caffe2-generator.version>0.2.14-SNAPSHOT</cnnarch-caffe2-generator.version>
<cnnarch-gluon-generator.version>0.2.12-SNAPSHOT</cnnarch-gluon-generator.version>
<cnnarch-gluon-generator.version>0.4.0-SNAPSHOT</cnnarch-gluon-generator.version>
<cnnarch-tensorflow-generator.version>0.1.0-SNAPSHOT</cnnarch-tensorflow-generator.version>
<Common-MontiCar.version>0.0.19-SNAPSHOT</Common-MontiCar.version>
<Common-MontiCar.version>0.2.12-SNAPSHOT</Common-MontiCar.version>
<embedded-montiarc-math-opt-generator>0.1.6</embedded-montiarc-math-opt-generator>
<!-- .. Libraries .................................................. -->
......
......@@ -342,12 +342,9 @@ public class EMADLGenerator {
fileContents.addAll(generateCNNTrainer(allInstances, instanceName));fileContents.add(ArmadilloHelper.getArmadilloHelperFileContent());
TypesGeneratorCPP tg = new TypesGeneratorCPP();
fileContents.addAll(tg.generateTypes(TypeConverter.getTypeSymbols()));
if (cnnArchGenerator.isCMakeRequired()) {
if (cnnArchGenerator.isGenerateCMake()) {
cnnArchGenerator.setGenerationTargetPath(getGenerationTargetPath());
Map<String, String> cmakeContentsMap = cnnArchGenerator.generateCMakeContent(componentInstanceSymbol.getFullName());
for (String fileName : cmakeContentsMap.keySet()){
fileContents.add(new FileContent(cmakeContentsMap.get(fileName), fileName));
}
fileContents.addAll(cnnArchGenerator.generateCMakeContent(componentInstanceSymbol.getFullName()));
}
if (emamGen.shouldGenerateMainClass()) {
......@@ -503,28 +500,33 @@ public class EMADLGenerator {
}
public void generateCNN(List<FileContent> fileContents, TaggingResolver taggingResolver, EMAComponentInstanceSymbol instance, ArchitectureSymbol architecture){
Map<String,String> contentMap = cnnArchGenerator.generateStrings(architecture);
//Map<String,String> contentMap = cnnArchGenerator.generateStrings(taggingResolver, architecture);
List<FileContent> contentList = cnnArchGenerator.generateStrings(taggingResolver, architecture);
String fullName = instance.getFullName().replaceAll("\\.", "_");
//get the components execute method
String executeKey = "execute_" + fullName;
String executeMethod = contentMap.get(executeKey);
if (executeMethod == null){
String executeMethod = null;
FileContent executeContent = null;
String applyBeamSearchMethod = null;
for (FileContent content : contentList){
if (content.getFileName().equals("execute_" + fullName)){
executeMethod = content.getFileContent();
executeContent = content;
}else if (content.getFileName().equals("BeamSearch_" + fullName)){
applyBeamSearchMethod = content.getFileContent();
}
}
if (executeMethod == null) {
throw new IllegalStateException("execute method of " + fullName + " not found");
}else{
contentList.remove(executeContent);
}
contentMap.remove(executeKey);
String applyBeamSearchMethod = contentMap.get("BeamSearch_" + fullName);
String component = emamGen.generateString(taggingResolver, instance, (MathStatementsSymbol) null);
FileContent componentFileContent = new FileContent(
transformComponent(component, "CNNPredictor_" + fullName, applyBeamSearchMethod, executeMethod, architecture),
instance);
for (String fileName : contentMap.keySet()){
fileContents.add(new FileContent(contentMap.get(fileName), fileName));
}
fileContents.add(componentFileContent);
fileContents.addAll(contentList);
fileContents.add(new FileContent(readResource("CNNTranslator.h", Charsets.UTF_8), "CNNTranslator.h"));
}
......@@ -735,10 +737,7 @@ public class EMADLGenerator {
}
cnnTrainGenerator.setInstanceName(componentInstance.getFullName().replaceAll("\\.", "_"));
Map<String, String> fileContentMap = cnnTrainGenerator.generateStrings(configuration);
for (String fileName : fileContentMap.keySet()){
fileContents.add(new FileContent(fileContentMap.get(fileName), fileName));
}
fileContents.addAll(cnnTrainGenerator.generateStrings(configuration));
}
}
return fileContents;
......
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