@Override
public org.deeplearning4j.nn.api.Layer instantiate(NeuralNetConfiguration conf,
Collection<IterationListener> iterationListeners, int layerIndex, INDArray layerParamsView,
boolean initializeParams) {
org.deeplearning4j.nn.api.Layer underlying = layer.instantiate(getInnerConf(conf), iterationListeners,
layerIndex, layerParamsView, initializeParams);
NeuralNetConfiguration nncUnderlying = underlying.conf();
if (nncUnderlying.variables() != null) {
List<String> vars = nncUnderlying.variables(true);
nncUnderlying.clearVariables();
conf.clearVariables();
for (String s : vars) {
conf.variables(false).add(s);
conf.getL1ByParam().put(s, 0.0);
conf.getL2ByParam().put(s, 0.0);
conf.getLearningRateByParam().put(s, 0.0);
nncUnderlying.variables(false).add(s);
nncUnderlying.getL1ByParam().put(s, 0.0);
nncUnderlying.getL2ByParam().put(s, 0.0);
nncUnderlying.getLearningRateByParam().put(s, 0.0);
}
}
return new org.deeplearning4j.nn.layers.FrozenLayer(underlying);
}