Commit df09d622 authored by nilsfreyer's avatar nilsfreyer

adapted tests

parent 5880370f
Pipeline #101788 failed with stages
in 32 seconds
......@@ -29,6 +29,7 @@ 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.cnnarch.DataPathConfigParser;
import de.monticore.lang.monticar.generator.FileContent;
import de.monticore.lang.monticar.generator.cmake.CMakeConfig;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
......@@ -47,6 +48,7 @@ import java.util.List;
public class CNNArch2Caffe2 implements CNNArchGenerator{
private String generationTargetPath;
private String modelPath;
private boolean isSupportedLayer(ArchitectureElementSymbol element, LayerSupportChecker layerChecker){
List<ArchitectureElementSymbol> constructLayerElemList;
......@@ -75,6 +77,14 @@ public class CNNArch2Caffe2 implements CNNArchGenerator{
return true;
}
public String getModelPath(){
return modelPath;
}
public void setModelPath(Path modelPath){
this.modelPath = modelPath.toString();
}
public CNNArch2Caffe2() {
setGenerationTargetPath("./target/generated-sources-cnnarch/");
}
......@@ -98,6 +108,7 @@ public class CNNArch2Caffe2 implements CNNArchGenerator{
public void generate(Path modelsDirPath, String rootModelName){
final ModelPath mp = new ModelPath(modelsDirPath);
GlobalScope scope = new GlobalScope(mp, new CNNArchLanguage());
setModelPath(modelsDirPath);
generate(scope, rootModelName);
}
......@@ -115,6 +126,11 @@ public class CNNArch2Caffe2 implements CNNArchGenerator{
}
try{
String confPath = getModelPath() + "/data_paths.txt";
DataPathConfigParser newParserConfig = new DataPathConfigParser(confPath);
String dataPath = newParserConfig.getDataPath(rootModelName);
compilationUnit.get().getArchitecture().setDataPath(dataPath);
compilationUnit.get().getArchitecture().setComponentName(rootModelName);
generateFiles(compilationUnit.get().getArchitecture());
}
catch (IOException e){
......
......@@ -11,8 +11,8 @@ class ${tc.fileNameWithoutEnding}:
module = None
_current_dir_ = os.path.join('./')
_data_dir_ = os.path.join(_current_dir_, 'data', '${tc.fullArchitectureName}')
_model_dir_ = os.path.join(_current_dir_, 'model', '${tc.fullArchitectureName}')
_data_dir_ = os.path.join(_current_dir_, '${tc.dataPath}')
_model_dir_ = os.path.join(_current_dir_, 'model', '${tc.componentName}')
_init_net_ = os.path.join(_model_dir_, 'init_net.pb')
_predict_net_ = os.path.join(_model_dir_, 'predict_net.pb')
......
......@@ -18,8 +18,8 @@
#include <iostream>
#include <map>
CAFFE2_DEFINE_string(init_net, "./model/${tc.fullArchitectureName}/init_net.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net, "./model/${tc.fullArchitectureName}/predict_net.pb", "The given path to the predict protobuffer.");
CAFFE2_DEFINE_string(init_net, "./model/${tc.componentName}/init_net.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net, "./model/${tc.componentName}/predict_net.pb", "The given path to the predict protobuffer.");
using namespace caffe2;
......
......@@ -11,7 +11,7 @@ class CNNCreator_Alexnet:
module = None
_current_dir_ = os.path.join('./')
_data_dir_ = os.path.join(_current_dir_, 'data', 'Alexnet')
_data_dir_ = os.path.join(_current_dir_, 'data/Alexnet')
_model_dir_ = os.path.join(_current_dir_, 'model', 'Alexnet')
_init_net_ = os.path.join(_model_dir_, 'init_net.pb')
......
......@@ -11,7 +11,7 @@ class CNNCreator_CifarClassifierNetwork:
module = None
_current_dir_ = os.path.join('./')
_data_dir_ = os.path.join(_current_dir_, 'data', 'CifarClassifierNetwork')
_data_dir_ = os.path.join(_current_dir_, 'data/CifarClassifierNetwork')
_model_dir_ = os.path.join(_current_dir_, 'model', 'CifarClassifierNetwork')
_init_net_ = os.path.join(_model_dir_, 'init_net.pb')
......
......@@ -11,7 +11,7 @@ class CNNCreator_LeNet:
module = None
_current_dir_ = os.path.join('./')
_data_dir_ = os.path.join(_current_dir_, 'data', 'LeNet')
_data_dir_ = os.path.join(_current_dir_, 'data/LeNet')
_model_dir_ = os.path.join(_current_dir_, 'model', 'LeNet')
_init_net_ = os.path.join(_model_dir_, 'init_net.pb')
......
......@@ -11,7 +11,7 @@ class CNNCreator_VGG16:
module = None
_current_dir_ = os.path.join('./')
_data_dir_ = os.path.join(_current_dir_, 'data', 'VGG16')
_data_dir_ = os.path.join(_current_dir_, 'data/VGG16')
_model_dir_ = os.path.join(_current_dir_, 'model', 'VGG16')
_init_net_ = os.path.join(_model_dir_, 'init_net.pb')
......
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