...
 
Commits (5)
......@@ -9,16 +9,16 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>cnnarch-caffe2-generator</artifactId>
<version>0.2.13-SNAPSHOT</version>
<version>0.2.14-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. SE-Libraries .................................................. -->
<CNNArch.version>0.3.2-SNAPSHOT</CNNArch.version>
<CNNTrain.version>0.3.6-SNAPSHOT</CNNTrain.version>
<CNNArch2X.version>0.0.3-SNAPSHOT</CNNArch2X.version>
<CNNArch.version>0.3.4-SNAPSHOT</CNNArch.version>
<CNNTrain.version>0.3.9-SNAPSHOT</CNNTrain.version>
<CNNArch2X.version>0.0.5-SNAPSHOT</CNNArch2X.version>
<embedded-montiarc-math-opt-generator>0.1.4</embedded-montiarc-math-opt-generator>
<!-- .. Libraries .................................................. -->
......
......@@ -141,7 +141,7 @@ public class CNNArchTemplateController {
include(TEMPLATE_ELEMENTS_DIR_PATH, "Output", writer);
}
} else {
include(element.getResolvedThis().get(), writer);
include((ArchitectureElementSymbol) element.getResolvedThis().get(), writer);
}
setCurrentElement(previousElement);
......@@ -158,7 +158,7 @@ public class CNNArchTemplateController {
include(TEMPLATE_ELEMENTS_DIR_PATH, templateName, writer);
}
} else {
include(layer.getResolvedThis().get(), writer);
include((ArchitectureElementSymbol) layer.getResolvedThis().get(), writer);
}
setCurrentElement(previousElement);
......
......@@ -2,6 +2,7 @@
package de.monticore.lang.monticar.cnnarch.caffe2generator;
import de.monticore.lang.monticar.cnntrain._symboltable.*;
import static de.monticore.lang.monticar.cnntrain.helper.ConfigEntryNameConstants.*;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -61,11 +62,8 @@ public class ConfigurationData {
return getConfiguration().getEntry("context").getValue().toString();
}
public String getEvalMetric() {
if (!getConfiguration().getEntryMap().containsKey("eval_metric")) {
return null;
}
return getConfiguration().getEntry("eval_metric").getValue().toString();
public Map<String, Object> getEvalMetric() {
return getMultiParamEntry(EVAL_METRIC, "name");
}
public String getLoss() {
......@@ -104,4 +102,29 @@ public class ConfigurationData {
}
return mapToStrings;
}
protected Map<String, Object> getMultiParamEntry(final String key, final String valueName) {
if (!configurationContainsKey(key)) {
return null;
}
Map<String, Object> resultView = new HashMap<>();
ValueSymbol value = this.getConfiguration().getEntryMap().get(key).getValue();
if (value instanceof MultiParamValueSymbol) {
MultiParamValueSymbol multiParamValue = (MultiParamValueSymbol) value;
resultView.put(valueName, multiParamValue.getValue());
resultView.putAll(multiParamValue.getParameters());
}
else {
resultView.put(valueName, value.getValue());
}
return resultView;
}
protected Boolean configurationContainsKey(final String key) {
return this.getConfiguration().getEntryMap().containsKey(key);
}
}
......@@ -28,7 +28,7 @@ if __name__ == "__main__":
context='${config.context}',
</#if>
<#if (config.evalMetric)??>
eval_metric='${config.evalMetric}',
eval_metric='${config.evalMetric.name}',
</#if>
<#if (config.loss)??>
loss='${config.loss}',
......
#(c) https://github.com/MontiCore/monticore
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 14)
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2
......@@ -92,6 +91,7 @@ class CNNCreator_LeNet:
return predictions_
# this adds the loss and optimizer
def add_training_operators(self, model, output, label, device_opts, loss, opt_type, base_learning_rate, policy, stepsize, epsilon, beta1, beta2, gamma, momentum) :
with core.DeviceScope(device_opts):
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2
......@@ -138,6 +137,7 @@ class CNNCreator_VGG16:
return predictions_
# this adds the loss and optimizer
def add_training_operators(self, model, output, label, device_opts, loss, opt_type, base_learning_rate, policy, stepsize, epsilon, beta1, beta2, gamma, momentum) :
with core.DeviceScope(device_opts):
......
/* (c) https://github.com/MontiCore/monticore */
#ifndef CNNPREDICTOR_LENET
#define CNNPREDICTOR_LENET
......
/* (c) https://github.com/MontiCore/monticore */
#ifndef CNNPREDICTOR_VGG16
#define CNNPREDICTOR_VGG16
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2
......
# (c) https://github.com/MontiCore/monticore
# Automatically generated file
#
# - Try to find Armadillo
......@@ -36,4 +35,4 @@ mark_as_advanced(
)
set(Armadillo_INCLUDE_DIRS ${Armadillo_INCLUDE_DIR})
set(Armadillo_LIBRARIES ${Armadillo_LIBRARY})
set(Armadillo_LIBRARIES ${Armadillo_LIBRARY})
\ No newline at end of file