use of org.deeplearning4j.nn.conf.layers.FeedForwardLayer in project deeplearning4j by deeplearning4j.
the class FlowIterationListener method getLayerInfo.
private LayerInfo getLayerInfo(Layer layer, int x, int y, int order) {
LayerInfo info = new LayerInfo();
// set coordinates
info.setX(x);
info.setY(y);
// if name was set, we should grab it
try {
info.setName(layer.conf().getLayer().getLayerName());
} catch (Exception e) {
}
if (info.getName() == null || info.getName().isEmpty())
info.setName("unnamed");
// unique layer id required here
info.setId(order);
// set layer description according to layer params
Description description = new Description();
info.setDescription(description);
// set layer type
try {
info.setLayerType(layer.getClass().getSimpleName().replaceAll("Layer$", ""));
} catch (Exception e) {
info.setLayerType("n/a");
return info;
}
StringBuilder mainLine = new StringBuilder();
StringBuilder subLine = new StringBuilder();
StringBuilder fullLine = new StringBuilder();
if (layer.type().equals(Layer.Type.CONVOLUTIONAL)) {
org.deeplearning4j.nn.conf.layers.ConvolutionLayer layer1 = (org.deeplearning4j.nn.conf.layers.ConvolutionLayer) layer.conf().getLayer();
mainLine.append("K: " + Arrays.toString(layer1.getKernelSize()) + " S: " + Arrays.toString(layer1.getStride()) + " P: " + Arrays.toString(layer1.getPadding()));
subLine.append("nIn/nOut: [" + layer1.getNIn() + "/" + layer1.getNOut() + "]");
fullLine.append("Kernel size: ").append(Arrays.toString(layer1.getKernelSize())).append("<br/>");
fullLine.append("Stride: ").append(Arrays.toString(layer1.getStride())).append("<br/>");
fullLine.append("Padding: ").append(Arrays.toString(layer1.getPadding())).append("<br/>");
fullLine.append("Inputs number: ").append(layer1.getNIn()).append("<br/>");
fullLine.append("Outputs number: ").append(layer1.getNOut()).append("<br/>");
} else if (layer.conf().getLayer() instanceof SubsamplingLayer) {
SubsamplingLayer layer1 = (SubsamplingLayer) layer.conf().getLayer();
fullLine.append("Kernel size: ").append(Arrays.toString(layer1.getKernelSize())).append("<br/>");
fullLine.append("Stride: ").append(Arrays.toString(layer1.getStride())).append("<br/>");
fullLine.append("Padding: ").append(Arrays.toString(layer1.getPadding())).append("<br/>");
fullLine.append("Pooling type: ").append(layer1.getPoolingType().toString()).append("<br/>");
} else if (layer.conf().getLayer() instanceof FeedForwardLayer) {
org.deeplearning4j.nn.conf.layers.FeedForwardLayer layer1 = (org.deeplearning4j.nn.conf.layers.FeedForwardLayer) layer.conf().getLayer();
mainLine.append("nIn/nOut: [" + layer1.getNIn() + "/" + layer1.getNOut() + "]");
subLine.append(info.getLayerType());
fullLine.append("Inputs number: ").append(layer1.getNIn()).append("<br/>");
fullLine.append("Outputs number: ").append(layer1.getNOut()).append("<br/>");
} else {
// TODO: Introduce Layer.Type.OUTPUT
if (layer instanceof BaseOutputLayer) {
mainLine.append("Outputs: [" + ((org.deeplearning4j.nn.conf.layers.BaseOutputLayer) layer.conf().getLayer()).getNOut() + "]");
fullLine.append("Outputs number: ").append(((org.deeplearning4j.nn.conf.layers.BaseOutputLayer) layer.conf().getLayer()).getNOut()).append("<br/>");
}
}
subLine.append(" A: [").append(layer.conf().getLayer().getActivationFn().toString()).append("]");
fullLine.append("Activation function: ").append("<b>").append(layer.conf().getLayer().getActivationFn().toString()).append("</b>").append("<br/>");
description.setMainLine(mainLine.toString());
description.setSubLine(subLine.toString());
description.setText(fullLine.toString());
return info;
}
use of org.deeplearning4j.nn.conf.layers.FeedForwardLayer in project deeplearning4j by deeplearning4j.
the class RemoteFlowIterationListener method getLayerInfo.
private LayerInfo getLayerInfo(Layer layer, int x, int y, int order) {
LayerInfo info = new LayerInfo();
// set coordinates
info.setX(x);
info.setY(y);
// if name was set, we should grab it
try {
info.setName(layer.conf().getLayer().getLayerName());
} catch (Exception e) {
}
if (info.getName() == null || info.getName().isEmpty())
info.setName("unnamed");
// unique layer id required here
info.setId(order);
// set layer description according to layer params
Description description = new Description();
info.setDescription(description);
// set layer type
try {
info.setLayerType(layer.getClass().getSimpleName().replaceAll("Layer$", ""));
} catch (Exception e) {
info.setLayerType("n/a");
return info;
}
StringBuilder mainLine = new StringBuilder();
StringBuilder subLine = new StringBuilder();
StringBuilder fullLine = new StringBuilder();
if (layer.type().equals(Layer.Type.CONVOLUTIONAL)) {
org.deeplearning4j.nn.conf.layers.ConvolutionLayer layer1 = (org.deeplearning4j.nn.conf.layers.ConvolutionLayer) layer.conf().getLayer();
mainLine.append("K: " + Arrays.toString(layer1.getKernelSize()) + " S: " + Arrays.toString(layer1.getStride()) + " P: " + Arrays.toString(layer1.getPadding()));
subLine.append("nIn/nOut: [" + layer1.getNIn() + "/" + layer1.getNOut() + "]");
fullLine.append("Kernel size: ").append(Arrays.toString(layer1.getKernelSize())).append("<br/>");
fullLine.append("Stride: ").append(Arrays.toString(layer1.getStride())).append("<br/>");
fullLine.append("Padding: ").append(Arrays.toString(layer1.getPadding())).append("<br/>");
fullLine.append("Inputs number: ").append(layer1.getNIn()).append("<br/>");
fullLine.append("Outputs number: ").append(layer1.getNOut()).append("<br/>");
} else if (layer.conf().getLayer() instanceof SubsamplingLayer) {
SubsamplingLayer layer1 = (SubsamplingLayer) layer.conf().getLayer();
fullLine.append("Kernel size: ").append(Arrays.toString(layer1.getKernelSize())).append("<br/>");
fullLine.append("Stride: ").append(Arrays.toString(layer1.getStride())).append("<br/>");
fullLine.append("Padding: ").append(Arrays.toString(layer1.getPadding())).append("<br/>");
fullLine.append("Pooling type: ").append(layer1.getPoolingType().toString()).append("<br/>");
} else if (layer.conf().getLayer() instanceof FeedForwardLayer) {
FeedForwardLayer layer1 = (FeedForwardLayer) layer.conf().getLayer();
mainLine.append("nIn/nOut: [" + layer1.getNIn() + "/" + layer1.getNOut() + "]");
subLine.append(info.getLayerType());
fullLine.append("Inputs number: ").append(layer1.getNIn()).append("<br/>");
fullLine.append("Outputs number: ").append(layer1.getNOut()).append("<br/>");
} else {
// TODO: Introduce Layer.Type.OUTPUT
if (layer instanceof BaseOutputLayer) {
mainLine.append("Outputs: [" + ((BaseOutputLayer) layer.conf().getLayer()).getNOut() + "]");
fullLine.append("Outputs number: ").append(((BaseOutputLayer) layer.conf().getLayer()).getNOut()).append("<br/>");
}
}
subLine.append(" A: [").append(layer.conf().getLayer().getActivationFn().toString()).append("]");
fullLine.append("Activation function: ").append("<b>").append(layer.conf().getLayer().getActivationFn().toString()).append("</b>").append("<br/>");
description.setMainLine(mainLine.toString());
description.setSubLine(subLine.toString());
description.setText(fullLine.toString());
return info;
}
Aggregations