Java Code Examples for org.deeplearning4j.nn.api.Layer#setParamTable()

The following examples show how to use org.deeplearning4j.nn.api.Layer#setParamTable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CenterLossOutputLayer.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public Layer instantiate(NeuralNetConfiguration conf, Collection<TrainingListener> trainingListeners,
                         int layerIndex, INDArray layerParamsView, boolean initializeParams, DataType networkDataType) {
    LayerValidation.assertNInNOutSet("CenterLossOutputLayer", getLayerName(), layerIndex, getNIn(), getNOut());

    Layer ret = new org.deeplearning4j.nn.layers.training.CenterLossOutputLayer(conf, networkDataType);
    ret.setListeners(trainingListeners);
    ret.setIndex(layerIndex);
    ret.setParamsViewArray(layerParamsView);
    Map<String, INDArray> paramTable = initializer().init(conf, layerParamsView, initializeParams);
    ret.setParamTable(paramTable);
    ret.setConf(conf);
    return ret;
}
 
Example 2
Source File: BaseLayerTest.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetExistingParamsConvolutionSingleLayer() {
    Layer layer = configureSingleLayer();
    assertNotEquals(paramTable, layer.paramTable());

    layer.setParamTable(paramTable);
    assertEquals(paramTable, layer.paramTable());
}
 
Example 3
Source File: BaseLayerTest.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetExistingParamsDenseMultiLayer() {
    MultiLayerNetwork net = configureMultiLayer();

    for (Layer layer : net.getLayers()) {
        assertNotEquals(paramTable, layer.paramTable());
        layer.setParamTable(paramTable);
        assertEquals(paramTable, layer.paramTable());
    }
}