Search in sources :

Example 6 with FeedForwardLayer

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;
}
Also used : BaseOutputLayer(org.deeplearning4j.nn.conf.layers.BaseOutputLayer) SubsamplingLayer(org.deeplearning4j.nn.conf.layers.SubsamplingLayer) FeedForwardLayer(org.deeplearning4j.nn.conf.layers.FeedForwardLayer) FeedForwardLayer(org.deeplearning4j.nn.conf.layers.FeedForwardLayer)

Example 7 with FeedForwardLayer

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;
}
Also used : BaseOutputLayer(org.deeplearning4j.nn.conf.layers.BaseOutputLayer) SubsamplingLayer(org.deeplearning4j.nn.conf.layers.SubsamplingLayer) FeedForwardLayer(org.deeplearning4j.nn.conf.layers.FeedForwardLayer)

Aggregations

FeedForwardLayer (org.deeplearning4j.nn.conf.layers.FeedForwardLayer)7 SubsamplingLayer (org.deeplearning4j.nn.conf.layers.SubsamplingLayer)3 IOutputLayer (org.deeplearning4j.nn.api.layers.IOutputLayer)2 RecurrentLayer (org.deeplearning4j.nn.api.layers.RecurrentLayer)2 BaseOutputLayer (org.deeplearning4j.nn.conf.layers.BaseOutputLayer)2 FrozenLayer (org.deeplearning4j.nn.layers.FrozenLayer)2 DataSet (org.nd4j.linalg.dataset.DataSet)2 LabeledPoint (org.apache.spark.mllib.regression.LabeledPoint)1 Persistable (org.deeplearning4j.api.storage.Persistable)1 Layer (org.deeplearning4j.nn.api.Layer)1 ComputationGraphConfiguration (org.deeplearning4j.nn.conf.ComputationGraphConfiguration)1 MultiLayerConfiguration (org.deeplearning4j.nn.conf.MultiLayerConfiguration)1 NeuralNetConfiguration (org.deeplearning4j.nn.conf.NeuralNetConfiguration)1 Updater (org.deeplearning4j.nn.conf.Updater)1 GraphVertex (org.deeplearning4j.nn.conf.graph.GraphVertex)1 LayerVertex (org.deeplearning4j.nn.conf.graph.LayerVertex)1 ConvolutionLayer (org.deeplearning4j.nn.conf.layers.ConvolutionLayer)1 Layer (org.deeplearning4j.nn.conf.layers.Layer)1 GraphVertex (org.deeplearning4j.nn.graph.vertex.GraphVertex)1 LayerVertex (org.deeplearning4j.nn.graph.vertex.impl.LayerVertex)1