Aufgrund einer Wartung wird GitLab am 19.10. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 19.10. between 8:00 and 9:00 am.

Commit f2579cdb authored by Sebastian N.'s avatar Sebastian N.
Browse files

Merge rnn into develop

parents 449d6a35 f02920c0
Pipeline #150621 failed with stages
......@@ -5,7 +5,6 @@ nppBackup
.classpath
.idea
.git
*.iml
.vscode
*.iml
train.log
{
"configurations": [
{
"type": "java",
"name": "CodeLens (Launch) - EMADLGeneratorCli",
"request": "launch",
"mainClass": "de.monticore.lang.monticar.emadl.generator.EMADLGeneratorCli",
"projectName": "embedded-montiarc-emadl-generator"
}
]
}
\ No newline at end of file
......@@ -15,10 +15,10 @@
<properties>
<!-- .. SE-Libraries .................................................. -->
<emadl.version>0.2.6</emadl.version>
<emadl.version>0.2.8-SNAPSHOT</emadl.version>
<CNNTrain.version>0.3.2-SNAPSHOT</CNNTrain.version>
<cnnarch-mxnet-generator.version>0.2.15-SNAPSHOT</cnnarch-mxnet-generator.version>
<cnnarch-caffe2-generator.version>0.2.11-SNAPSHOT</cnnarch-caffe2-generator.version>
<cnnarch-mxnet-generator.version>0.2.16-SNAPSHOT</cnnarch-mxnet-generator.version>
<cnnarch-caffe2-generator.version>0.2.12-SNAPSHOT</cnnarch-caffe2-generator.version>
<cnnarch-gluon-generator.version>0.2.1-SNAPSHOT</cnnarch-gluon-generator.version>
<embedded-montiarc-math-opt-generator>0.1.4</embedded-montiarc-math-opt-generator>
......
......@@ -370,6 +370,8 @@ public class EMADLGenerator {
EMADLCocos.checkAll(componentInstanceSymbol);
if (architecture.isPresent()){
cnnArchGenerator.check(architecture.get());
String dPath = null;
Path dataPathDefinition = Paths.get(getModelsPath(), "data_paths.txt");
if (dataPathDefinition.toFile().exists()) {
......
......@@ -9,9 +9,6 @@ import de.se_rwth.commons.logging.Log;
import java.io.IOException;
import java.util.Optional;
/**
*
*/
public class RewardFunctionCppGenerator implements RewardFunctionSourceGenerator {
public RewardFunctionCppGenerator() {
}
......
......@@ -43,7 +43,6 @@ import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertFalse;
public class GenerationTest extends AbstractSymtabTest {
@Before
public void setUp() {
// ensure an empty log
......@@ -143,7 +142,7 @@ public class GenerationTest extends AbstractSymtabTest {
}
@Test
public void testMnistClassifier() throws IOException, TemplateException {
public void testMnistClassifierForCaffe2() throws IOException, TemplateException {
Log.getFindings().clear();
String[] args = {"-m", "src/test/resources/models/", "-r", "mnist.MnistClassifier", "-b", "CAFFE2", "-f", "n", "-c", "n"};
EMADLGeneratorCli.main(args);
......@@ -181,7 +180,7 @@ public class GenerationTest extends AbstractSymtabTest {
"CNNCreator_mnist_mnistClassifier_net.py",
"CNNPredictor_mnist_mnistClassifier_net.h",
"CNNDataLoader_mnist_mnistClassifier_net.py",
"supervised_trainer.py",
"CNNSupervisedTrainer_mnist_mnistClassifier_net.py",
"mnist_mnistClassifier_net.h",
"HelperA.h",
"CNNTranslator.h",
......
......@@ -20,28 +20,8 @@
*/
package de.monticore.lang.monticar.emadl;
import de.monticore.lang.monticar.emadl.generator.Backend;
import de.monticore.lang.monticar.emadl.generator.EMADLGenerator;
import de.monticore.lang.monticar.emadl.generator.EMADLGeneratorCli;
import de.se_rwth.commons.logging.Log;
import freemarker.template.TemplateException;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertFalse;
public class IntegrationCaffe2Test extends IntegrationTest {
public IntegrationCaffe2Test() {
super("CAFFE2", "39253EC049D4A4E5FA0536AD34874B9D#1DBAEE1B1BD83FB7CB5F70AE91B29638#13D139510DC5681639AA91D7250288D3#1A42D4842D0664937A9F6B727BD60CEF");
}
}
}
\ No newline at end of file
......@@ -20,8 +20,60 @@
*/
package de.monticore.lang.monticar.emadl;
import de.monticore.lang.monticar.emadl.generator.EMADLGeneratorCli;
import de.se_rwth.commons.logging.Log;
import org.junit.Test;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertFalse;
public class IntegrationGluonTest extends IntegrationTest {
private Path multipleInputsHashFile = Paths.get("./target/generated-sources-emadl/MultipleInputs.training_hash");
private Path multipleOutputsHashFile = Paths.get("./target/generated-sources-emadl/MultipleOutputs.training_hash");
public IntegrationGluonTest() {
super("GLUON", "39253EC049D4A4E5FA0536AD34874B9D#1DBAEE1B1BD83FB7CB5F70AE91B29638#C4C23549E737A759721D6694C75D9771#5AF0CE68E408E8C1F000E49D72AC214A");
}
@Test
public void testMultipleInputs() {
Log.getFindings().clear();
deleteHashFile(multipleInputsHashFile);
String[] args = {"-m", "src/test/resources/models/", "-r", "MultipleInputs", "-b", "GLUON"};
EMADLGeneratorCli.main(args);
assertTrue(Log.getFindings().isEmpty());
}
@Test
public void testMultipleOutputs() {
Log.getFindings().clear();
deleteHashFile(multipleOutputsHashFile);
String[] args = {"-m", "src/test/resources/models/", "-r", "MultipleOutputs", "-b", "GLUON"};
EMADLGeneratorCli.main(args);
assertTrue(Log.getFindings().isEmpty());
}
private void deleteHashFile(Path hashFile) {
try {
Files.delete(hashFile);
}
catch (NoSuchFileException e) {
}
catch(Exception e) {
assertFalse("Could not delete hash file", true);
}
}
}
......@@ -20,25 +20,6 @@
*/
package de.monticore.lang.monticar.emadl;
import de.monticore.lang.monticar.emadl.generator.Backend;
import de.monticore.lang.monticar.emadl.generator.EMADLGenerator;
import de.monticore.lang.monticar.emadl.generator.EMADLGeneratorCli;
import de.se_rwth.commons.logging.Log;
import freemarker.template.TemplateException;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertFalse;
public class IntegrationMXNetTest extends IntegrationTest {
public IntegrationMXNetTest() {
super("MXNET", "39253EC049D4A4E5FA0536AD34874B9D#1DBAEE1B1BD83FB7CB5F70AE91B29638#C4C23549E737A759721D6694C75D9771#5AF0CE68E408E8C1F000E49D72AC214A");
......
......@@ -41,7 +41,7 @@ component Alexnet{
fc(->=2) ->
FullyConnected(units=1000) ->
Softmax() ->
predictions
predictions;
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@ component NetworkB<Z classes = 10> (Z convChannels){
Dropout() ->
FullyConnected(units=classes) ->
Softmax() ->
predictions
predictions;
}
}
\ No newline at end of file
......@@ -27,6 +27,6 @@ component InvalidLayerInput{
fc() ->
FullyConnected(units=1000) ->
Softmax() ->
predictions
predictions;
}
}
\ No newline at end of file
configuration MultipleInputs{
num_epoch:10
batch_size:5
context:cpu
optimizer:adam{
learning_rate:0.01
learning_rate_decay:0.8
step_size:1000
weight_decay:0.0001
}
}
component MultipleInputs{
ports in Z(0:255)^{3, 32, 32} data[2],
out Q(0:1)^{10} softmax;
implementation CNN {
(
data[0] ->
Convolution(kernel=(5,5), channels=8, padding="valid") ->
Convolution(kernel=(5,5), channels=8, padding="valid") ->
FullyConnected(units=128) ->
Dropout()
|
data[1] ->
Convolution(kernel=(5,5), channels=8, padding="valid") ->
Convolution(kernel=(5,5), channels=8, padding="valid") ->
FullyConnected(units=128) ->
Dropout()
) ->
Concatenate() ->
FullyConnected(units=10) ->
Softmax() ->
softmax;
}
}
\ No newline at end of file
configuration MultipleOutputs{
num_epoch:10
batch_size:64
normalize:true
load_checkpoint:false
optimizer:adam{
learning_rate:0.01
learning_rate_decay:0.8
step_size:1000
}
num_epoch:10
batch_size:5
context:cpu
optimizer:adam{
learning_rate:0.01
learning_rate_decay:0.8
step_size:1000
weight_decay:0.0001
}
}
component MultipleOutputs{
ports in Q(-oo:+oo)^{10,1,1} data,
out Q(0:1)^{4} pred[2];
ports in Z(0:255)^{3, 32, 32} data,
out Q(0:1)^{10} pred[2];
implementation CNN {
data ->
FullyConnected(units=128, no_bias=true) ->
Tanh() ->
(
FullyConnected(units=16, no_bias=true) ->
Tanh() ->
FullyConnected(units=4, no_bias=true)
|
FullyConnected(units=16, no_bias=true) ->
Tanh() ->
FullyConnected(units=4, no_bias=true)
) ->
Convolution(kernel=(5,5), channels=8, padding="valid") ->
Convolution(kernel=(5,5), channels=8, padding="valid") ->
FullyConnected(units=128) ->
Dropout() ->
FullyConnected(units=10) ->
(
[0] ->
Softmax() ->
pred[0]
|
[1] ->
Softmax() ->
pred[1]
)
);
}
}
\ No newline at end of file
configuration MultipleOutputs{
num_epoch:10
batch_size:64
normalize:true
load_checkpoint:false
optimizer:adam{
learning_rate:0.01
learning_rate_decay:0.8
step_size:1000
}
}
component MultipleOutputs{
ports in Q(-oo:+oo)^{10,1,1} data,
out Q(0:1)^{4} pred[2];
implementation CNN {
data ->
FullyConnected(units=128, no_bias=true) ->
Tanh() ->
(
FullyConnected(units=16, no_bias=true) ->
Tanh() ->
FullyConnected(units=4, no_bias=true)
|
FullyConnected(units=16, no_bias=true) ->
Tanh() ->
FullyConnected(units=4, no_bias=true)
) ->
(
[0] ->
Softmax() ->
pred[0]
|
[1] ->
Softmax() ->
pred[1]
);
}
}
\ No newline at end of file
......@@ -40,6 +40,6 @@ component ResNeXt50{
GlobalPooling(pool_type="avg") ->
FullyConnected(units=1000) ->
Softmax() ->
predictions
predictions;
}
}
\ No newline at end of file
......@@ -34,6 +34,6 @@ component ResNet152{
GlobalPooling(pool_type="avg") ->
FullyConnected(units=1000) ->
Softmax() ->
predictions
predictions;
}
}
\ 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