Commit 8fd8db74 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko

Merge branch 'develop' into 'master'

Added new layers

See merge request !4
parents a5585368 9211bf1c
Pipeline #173510 passed with stages
in 5 minutes and 41 seconds
......@@ -8,15 +8,15 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>cnnarch-generator</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.0.4-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. SE-Libraries .................................................. -->
<CNNArch.version>0.3.2-SNAPSHOT</CNNArch.version>
<CNNTrain.version>0.3.4-SNAPSHOT</CNNTrain.version>
<CNNArch.version>0.3.3-SNAPSHOT</CNNArch.version>
<CNNTrain.version>0.3.6-SNAPSHOT</CNNTrain.version>
<embedded-montiarc-math-opt-generator>0.1.4</embedded-montiarc-math-opt-generator>
<!-- .. Libraries .................................................. -->
......
......@@ -80,14 +80,22 @@ public class ArchitectureElementData {
}
}
public boolean isVariable() {
return getElement() instanceof VariableSymbol;
}
public List<String> getInputs(){
return getTemplateController().getLayerInputs(getElement());
}
public String getMember() {
assert getElement() instanceof VariableSymbol;
if (getElement() instanceof VariableSymbol) {
return ((VariableSymbol) getElement()).getMember().toString();
}
else {
return VariableSymbol.Member.NONE.toString();
}
return ((VariableSymbol) getElement()).getMember().toString();
}
public int getConstValue() {
......@@ -156,6 +164,22 @@ public class ArchitectureElementData {
return getLayerSymbol().getIntValue(AllPredefinedLayers.LAYERS_NAME).get();
}
public int getInputDim(){
return getLayerSymbol().getIntValue(AllPredefinedLayers.INPUT_DIM_NAME).get();
}
public int getOutputDim(){
return getLayerSymbol().getIntValue(AllPredefinedLayers.OUTPUT_DIM_NAME).get();
}
public boolean getBidirectional() {
return getLayerSymbol().getBooleanValue(AllPredefinedLayers.BIDIRECTIONAL_NAME).get();
}
public boolean getFlatten() {
return getLayerSymbol().getBooleanValue(AllPredefinedLayers.FLATTEN_PARAMETER_NAME).get();
}
@Nullable
public String getPoolType(){
return getLayerSymbol().getStringValue(AllPredefinedLayers.POOL_TYPE_NAME).get();
......
......@@ -107,12 +107,27 @@ public abstract class ArchitectureSupportChecker {
return true;
}
protected boolean checkOutputAsInput(ArchitectureSymbol architecture) {
for (SerialCompositeElementSymbol stream : architecture.getStreams()) {
for (ArchitectureElementSymbol element : stream.getFirstAtomicElements()) {
if (element.isOutput()) {
Log.error("This cnn architecture uses an output as an input, which is currently not supported by the code generator."
, architecture.getSourcePosition());
return false;
}
}
}
return true;
}
public boolean check(ArchitectureSymbol architecture) {
return checkMultipleStreams(architecture)
&& checkMultipleInputs(architecture)
&& checkMultipleOutputs(architecture)
&& checkMultiDimensionalOutput(architecture)
&& checkConstants(architecture)
&& checkLayerVariables(architecture);
&& checkLayerVariables(architecture)
&& checkOutputAsInput(architecture);
}
}
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