Commit a0cd974e authored by Julian Dierkes's avatar Julian Dierkes

beginning adding GAN features

parent 9f246d97
......@@ -203,4 +203,40 @@ public class ArchitectureElementData {
return Arrays.asList(0,0,0,0,topPad,bottomPad,leftPad,rightPad);
}
@Nullable
public List<Integer> getTransPadding(){
String pad = ((LayerSymbol) getElement()).getStringValue(AllPredefinedLayers.TRANSPADDING_NAME).get();
if(pad.equals("same")){
return getTransPadding(getLayerSymbol()); //The padding calculated here is only used in the gluon/ mxnet backend, in the tensorlflow one it is interpreted as "same"
}else if(pad.equals("valid")){
return Arrays.asList(0,0);
}else{ //"no loss"
return Arrays.asList(0,0,-1,0,0,0,0,0);
}
}
@Nullable
public List<Integer> getTransPadding(LayerSymbol layer){
List<Integer> kernel = layer.getIntTupleValue(AllPredefinedLayers.KERNEL_NAME).get();
List<Integer> stride = layer.getIntTupleValue(AllPredefinedLayers.STRIDE_NAME).get();
ArchTypeSymbol inputType = layer.getInputTypes().get(0);
ArchTypeSymbol outputType = layer.getOutputTypes().get(0);
int heightPad = kernel.get(0) - stride.get(0);
int widthPad = kernel.get(1) - stride.get(1);
int topPad = (int)Math.ceil(heightPad / 2.0);
int bottomPad = (int)Math.floor(heightPad / 2.0);
int leftPad = (int)Math.ceil(widthPad / 2.0);
int rightPad = (int)Math.floor(widthPad / 2.0);
/*if (topPad == 0 && bottomPad == 0 && leftPad == 0 && rightPad == 0){
return null;
}*/
return Arrays.asList(bottomPad, rightPad);
}
}
\ 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