Commit f815ea1f authored by Julian Dierkes's avatar Julian Dierkes

beginning of adding GAN features

parent 12e2c374
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<groupId>de.monticore.lang.monticar</groupId> <groupId>de.monticore.lang.monticar</groupId>
<artifactId>cnn-arch</artifactId> <artifactId>cnn-arch</artifactId>
<version>0.3.4-SNAPSHOT</version> <version>0.3.3-SNAPSHOT</version>
......
...@@ -166,6 +166,24 @@ public enum Constraints { ...@@ -166,6 +166,24 @@ public enum Constraints {
+ AllPredefinedLayers.PADDING_NO_LOSS; + AllPredefinedLayers.PADDING_NO_LOSS;
} }
}, },
TRANSPADDING_TYPE {
@Override
public boolean isValid(ArchSimpleExpressionSymbol exp) {
Optional<String> optString= exp.getStringValue();
if (optString.isPresent()){
if (optString.get().equals(AllPredefinedLayers.PADDING_VALID)
|| optString.get().equals(AllPredefinedLayers.PADDING_SAME)) {
return true;
}
}
return false;
}
@Override
protected String msgString() {
return AllPredefinedLayers.PADDING_VALID + "or "
+ AllPredefinedLayers.PADDING_SAME;
}
},
POOL_TYPE { POOL_TYPE {
@Override @Override
public boolean isValid(ArchSimpleExpressionSymbol exp) { public boolean isValid(ArchSimpleExpressionSymbol exp) {
......
...@@ -191,7 +191,7 @@ abstract public class PredefinedLayerDeclaration extends LayerDeclarationSymbol ...@@ -191,7 +191,7 @@ abstract public class PredefinedLayerDeclaration extends LayerDeclarationSymbol
//output type function for transposed convolution //output type function for transposed convolution
protected static List<ArchTypeSymbol> computeTransConvOutputShape(ArchTypeSymbol inputType, LayerSymbol method, int channels) { protected static List<ArchTypeSymbol> computeTransConvOutputShape(ArchTypeSymbol inputType, LayerSymbol method, int channels) {
String borderModeSetting = method.getStringValue(AllPredefinedLayers.PADDING_NAME).get(); String borderModeSetting = method.getStringValue(AllPredefinedLayers.TRANSPADDING_NAME).get();
if (borderModeSetting.equals(AllPredefinedLayers.PADDING_SAME)){ if (borderModeSetting.equals(AllPredefinedLayers.PADDING_SAME)){
return computeTransConvOutputShapeWithSamePadding(inputType, method, channels); return computeTransConvOutputShapeWithSamePadding(inputType, method, channels);
} }
......
...@@ -52,6 +52,7 @@ public class AllPredefinedLayers { ...@@ -52,6 +52,7 @@ public class AllPredefinedLayers {
public static final String LSTM_NAME = "LSTM"; public static final String LSTM_NAME = "LSTM";
public static final String GRU_NAME = "GRU"; public static final String GRU_NAME = "GRU";
public static final String EMBEDDING_NAME = "Embedding"; public static final String EMBEDDING_NAME = "Embedding";
public static final String IMG_RESIZE_NAME = "ImgResize";
//predefined argument names //predefined argument names
public static final String KERNEL_NAME = "kernel"; public static final String KERNEL_NAME = "kernel";
...@@ -68,6 +69,7 @@ public class AllPredefinedLayers { ...@@ -68,6 +69,7 @@ public class AllPredefinedLayers {
public static final String ALPHA_NAME = "alpha"; public static final String ALPHA_NAME = "alpha";
public static final String BETA_NAME = "beta"; public static final String BETA_NAME = "beta";
public static final String PADDING_NAME = "padding"; public static final String PADDING_NAME = "padding";
public static final String TRANSPADDING_NAME = "padding";
public static final String POOL_TYPE_NAME = "pool_type"; public static final String POOL_TYPE_NAME = "pool_type";
public static final String SIZE_NAME = "size"; public static final String SIZE_NAME = "size";
public static final String LAYERS_NAME = "layers"; public static final String LAYERS_NAME = "layers";
......
...@@ -30,8 +30,7 @@ import java.util.*; ...@@ -30,8 +30,7 @@ import java.util.*;
public class LeakyRelu extends PredefinedLayerDeclaration { public class LeakyRelu extends PredefinedLayerDeclaration {
private LeakyRelu() { private LeakyRelu() { super(AllPredefinedLayers.LEAKY_RELU_NAME);
super(AllPredefinedLayers.LEAKY_RELU_NAME);
} }
@Override @Override
......
...@@ -66,8 +66,8 @@ public class TransConv extends PredefinedLayerDeclaration { ...@@ -66,8 +66,8 @@ public class TransConv extends PredefinedLayerDeclaration {
.defaultValue(false) .defaultValue(false)
.build(), .build(),
new ParameterSymbol.Builder() new ParameterSymbol.Builder()
.name(AllPredefinedLayers.PADDING_NAME) .name(AllPredefinedLayers.TRANSPADDING_NAME)
.constraints(Constraints.PADDING_TYPE) .constraints(Constraints.TRANSPADDING_TYPE)
.defaultValue(AllPredefinedLayers.PADDING_SAME) .defaultValue(AllPredefinedLayers.PADDING_SAME)
.build())); .build()));
declaration.setParameters(parameters); declaration.setParameters(parameters);
......
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