Commit 153ba019 authored by Bernhard Rumpe's avatar Bernhard Rumpe

BR-sy

parent e3e00e7d
Pipeline #175142 failed with stages
in 48 seconds
# (c) https://github.com/MontiCore/monticore
# Java Maven CircleCI 2.0 configuration file
#
......
# (c) https://github.com/MontiCore/monticore
stages:
- windows
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- (c) https://github.com/MontiCore/monticore -->
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
</project>
# (c) https://github.com/MontiCore/monticore
script:
- git checkout ${TRAVIS_BRANCH}
- mvn clean install cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:report --settings "settings.xml"
......
<!-- (c) https://github.com/MontiCore/monticore -->
![pipeline](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/generators/CNNArch2MXNet/badges/master/build.svg)
![coverage](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/generators/CNNArch2MXNet/badges/master/coverage.svg)
\ No newline at end of file
![coverage](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/generators/CNNArch2MXNet/badges/master/coverage.svg)
<!-- (c) https://github.com/MontiCore/monticore -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- (c) https://github.com/MontiCore/monticore -->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
......
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import de.monticore.lang.monticar.cnnarch.generator.CNNArchGenerator;
......@@ -127,4 +108,4 @@ public class CNNArch2Gluon extends CNNArchGenerator {
}
return fileContentMap;
}
}
\ No newline at end of file
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
......
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import de.monticore.lang.monticar.cnnarch.generator.CNNArchGenerator;
......@@ -29,4 +10,4 @@ public class CNNArch2GluonCli {
GenericCNNArchCli cli = new GenericCNNArchCli(generator);
cli.run(args);
}
}
\ No newline at end of file
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedLayers;
......
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import de.monticore.lang.monticar.cnnarch.generator.ArchitectureElementData;
......
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import de.monticore.lang.monticar.cnnarch.generator.TrainParamSupportChecker;
public class CNNArch2GluonTrainParamSupportChecker extends TrainParamSupportChecker {
}
\ No newline at end of file
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import com.google.common.collect.Maps;
......@@ -253,4 +254,4 @@ public class CNNTrain2Gluon extends CNNTrainGenerator {
return fileContentMap;
}
}
\ No newline at end of file
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import de.monticore.lang.monticar.cnnarch.gluongenerator.reinforcement.RewardFunctionParameterAdapter;
......
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator;
import de.monticore.lang.monticar.cnnarch.generator.TemplateConfiguration;
......
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator;
/**
......
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator.annotations;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
......@@ -92,4 +93,4 @@ public class ArchitectureAdapter extends NNArchitectureSymbol {
ioSymbols.addAll(getIOInputSymbols());
return ioSymbols;
}
}
\ No newline at end of file
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator.reinforcement;
import de.se_rwth.commons.logging.Log;
......@@ -106,4 +107,4 @@ public class FunctionParameterChecker {
Log.error(message);
//System.exit(-1);
}
}
\ No newline at end of file
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator.reinforcement;
import de.monticore.lang.monticar.cnntrain.annotations.RewardFunctionParameter;
......@@ -133,4 +134,4 @@ public class RewardFunctionParameterAdapter implements RewardFunctionParameter {
return Optional.ofNullable(this.inputTerminalParameterName);
}
}
\ No newline at end of file
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.gluongenerator.reinforcement;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
......@@ -11,4 +12,4 @@ public interface RewardFunctionSourceGenerator {
EMAComponentInstanceSymbol resolveSymbol(TaggingResolver taggingResolver, String rootModel);
void generate(String modelPath, String rootModel, String targetPath);
void generate(EMAComponentInstanceSymbol componentInstanceSymbol, TaggingResolver taggingResolver, String targetPath);
}
\ No newline at end of file
}
<#-- (c) https://github.com/MontiCore/monticore -->
#ifndef CNNBUFFERFILE_H
#define CNNBUFFERFILE_H
......
<#-- (c) https://github.com/MontiCore/monticore -->
import mxnet as mx
import logging
import os
......
<#-- (c) https://github.com/MontiCore/monticore -->
import os
import h5py
import mxnet as mx
......@@ -90,4 +91,4 @@ class ${tc.fileNameWithoutEnding}:
return train_h5, test_h5
else:
logging.error("Data loading failure. File '" + os.path.abspath(train_path) + "' does not exist.")
sys.exit(1)
\ No newline at end of file
sys.exit(1)
<#-- (c) https://github.com/MontiCore/monticore -->
import mxnet as mx
import numpy as np
from mxnet import gluon
......@@ -92,4 +93,4 @@ ${tc.include(stream, "FORWARD_FUNCTION")}
return ${tc.join(tc.getStreamOutputNames(stream), ", ")}
</#if>
</#list>
\ No newline at end of file
</#list>
<#-- (c) https://github.com/MontiCore/monticore -->
#ifndef ${tc.fileNameWithoutEnding?upper_case}
#define ${tc.fileNameWithoutEnding?upper_case}
......
<#-- (c) https://github.com/MontiCore/monticore -->
import mxnet as mx
import logging
import numpy as np
......@@ -233,4 +234,4 @@ class ${tc.fileNameWithoutEnding}:
network.export(self.parameter_path(i) + '_newest', epoch=0)
def parameter_path(self, index):
return self._net_creator._model_dir_ + self._net_creator._model_prefix_ + '_' + str(index)
\ No newline at end of file
return self._net_creator._model_dir_ + self._net_creator._model_prefix_ + '_' + str(index)
<#-- (c) https://github.com/MontiCore/monticore -->
import logging
import mxnet as mx
<#list configurations as config>
......@@ -58,4 +59,4 @@ if __name__ == "__main__":
}
</#if>
)
</#list>
\ No newline at end of file
</#list>
<#-- (c) https://github.com/MontiCore/monticore -->
<#if mode == "FORWARD_FUNCTION">
${element.name} = ${tc.join(element.inputs, " + ")}
<#elseif mode == "PYTHON_INLINE">
......@@ -7,4 +8,4 @@
for (size_t i = 0; i != ${element.name}.size(); ++i) {
${element.name}[i] = ${tc.join(element.inputs, " + ", "", "[i]")};
}
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#-- TODO: Find solution for the CNNArch fix_gamma parameter of BatchNorm. Gluon does not provide this parameter-->
<#if mode == "ARCHITECTURE_DEFINITION">
......@@ -5,4 +6,4 @@
<#include "OutputShape.ftl">
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#if mode == "ARCHITECTURE_DEFINITION">
self.${element.name} = Concatenate(dim=1)
<#include "OutputShape.ftl">
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.${element.name}(${tc.join(element.inputs, ", ")})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#if mode == "FORWARD_FUNCTION">
${element.name} = gluon.Const('${element.name}', ${element.constValue})
<#elseif mode == "PYTHON_INLINE">
${element.name} = nd.array(${element.constValue})
<#elseif mode == "CPP_INLINE">
vector<float> ${element.name}{${element.constValue}};
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#if mode == "ARCHITECTURE_DEFINITION">
<#if element.padding??>
......@@ -14,4 +15,4 @@
<#assign input = element.name + "padding">
</#if>
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign rate = element.p?c>
<#assign input = element.inputs[0]>
<#if mode == "ARCHITECTURE_DEFINITION">
self.${element.name} = gluon.nn.Dropout(rate=${rate})
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#if mode == "ARCHITECTURE_DEFINITION">
self.${element.name} = gluon.nn.Embedding(input_dim=${element.inputDim?c}, output_dim=${element.outputDim?c})
<#include "OutputShape.ftl">
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#if mode == "ARCHITECTURE_DEFINITION">
self.${element.name} = gluon.nn.Flatten()
<#include "OutputShape.ftl">
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#assign units = element.units?c>
<#assign use_bias = element.noBias?string("False","True")>
......@@ -7,4 +8,4 @@
<#include "OutputShape.ftl">
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#if element.member == "NONE">
<#assign input = element.inputs[0]>
<#if mode == "ARCHITECTURE_DEFINITION">
......@@ -24,4 +25,4 @@
${element.name} = ${input}
</#if>
</#if>
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#if mode == "FORWARD_FUNCTION">
${element.name} = ${element.inputs[element.index]}
<#elseif mode == "PYTHON_INLINE">
${element.name} = ${element.inputs[element.index]}
<#elseif mode == "CPP_INLINE">
vector<float> ${element.name} = ${element.inputs[element.index]};
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#assign poolType = element.poolType>
<#if poolType == "avg">
......@@ -10,4 +11,4 @@
<#include "OutputShape.ftl">
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#if mode == "ARCHITECTURE_DEFINITION">
if data_mean:
assert(data_std)
......@@ -8,4 +9,4 @@
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.input_normalization_${element.name}(${element.name})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#if element.member == "NONE">
<#assign input = element.inputs[0]>
<#if mode == "ARCHITECTURE_DEFINITION">
......@@ -24,4 +25,4 @@
${element.name} = ${input}
</#if>
</#if>
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#if mode == "FORWARD_FUNCTION">
${element.name} = F.LRN(data=${input},
......@@ -5,4 +6,4 @@
beta=${element.beta?c},
knorm=${element.knorm?c},
nsize=${element.nsize?c})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#assign size = element.size?c>
<#if mode == "ARCHITECTURE_DEFINITION">
......@@ -10,4 +11,4 @@
<#elseif mode == "CPP_INLINE">
vector<float> ${element.name}(${size}, 0);
${element.name}[${input}[0]] = 1;
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#if element.inputs?size gte 1>
<#assign input = element.inputs[0]>
<#if mode == "FORWARD_FUNCTION">
......@@ -7,4 +8,4 @@
<#elseif mode == "CPP_INLINE">
${element.name} = ${input};
</#if>
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
# ${element.name}, output shape: {<#list element.element.outputTypes as type>[${tc.join(type.dimensions, ",")}]</#list>}
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#assign poolType = element.poolType>
<#assign poolSize = "(" + tc.join(element.kernel, ",") + ")">
......@@ -21,4 +22,4 @@
<#assign input = element.name + "padding">
</#if>
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#if element.member == "NONE">
<#assign input = element.inputs[0]>
<#if mode == "ARCHITECTURE_DEFINITION">
......@@ -25,4 +26,4 @@
${element.name} = ${input}
</#if>
</#if>
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#if mode == "ARCHITECTURE_DEFINITION">
self.${element.name} = gluon.nn.Activation(activation='relu')
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#if mode == "ARCHITECTURE_DEFINITION">
self.${element.name} = gluon.nn.Activation(activation='sigmoid')
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#-- This template is not used if the followiing architecture element is an output. See Output.ftl -->
<#assign input = element.inputs[0]>
<#if mode == "ARCHITECTURE_DEFINITION">
......
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>
<#assign num_outputs = element.numOutputs?c>
<#if mode == "ARCHITECTURE_DEFINITION">
......@@ -5,4 +6,4 @@
<#include "OutputShape.ftl">
<#elseif mode == "FORWARD_FUNCTION">
${element.name} = self.${element.name}(${input})
</#if>
\ No newline at end of file
</#if>
<#-- (c) https://github.com/MontiCore/monticore -->
<#assign input = element.inputs[0]>