filters = layers[0][2];
} else {
for (Connections c : prev.getConnections()) {
if (c.getOutputLayer() == prev) {
if (c instanceof Conv2DConnection) {
Conv2DConnection cc = (Conv2DConnection) c;
inputFMRows = cc.getOutputFeatureMapRows();
inputFMCols = cc.getOutputFeatureMapColumns();
filters = cc.getOutputFilters();
break;
} else if (c instanceof Subsampling2DConnection) {
Subsampling2DConnection sc = (Subsampling2DConnection) c;
inputFMRows = sc.getOutputFeatureMapRows();
inputFMCols = sc.getOutputFeatureMapColumns();
filters = sc.getFilters();
break;
}
}
}
}
if (l.length == 4) {
Conv2DConnection c = new Conv2DConnection(prev, newLayer = new Layer(), inputFMRows, inputFMCols, filters, l[0], l[1], l[2], l[3]);
if (addBias) {
new Conv2DConnection(biasLayer = new Layer(), newLayer, c.getOutputFeatureMapRows(), c.getOutputFeatureMapColumns(), 1, 1, 1, l[2], l[3]);
}
prevUnitCount = c.getOutputUnitCount();
} else if (l.length == 2) {
Subsampling2DConnection c = new Subsampling2DConnection(prev, newLayer = new Layer(), inputFMRows, inputFMCols, l[0], l[1], filters);
prevUnitCount = c.getOutputUnitCount();
}
}
result.addLayer(newLayer);
if (biasLayer != null) {