com.thoughtworks.deeplearning.plugins.CumulativeINDArrayLayers
The original forward operation passed in FloatLayer.apply.
The original forward operation passed in FloatLayer.apply.
This rawForward may be different from forward, in the case of forward was overriden by other plugins, e.g. CumulativeINDArrayLayers.
[use case]
Given an INDArrayLayer,
import org.nd4j.linalg.factory.Nd4j import com.thoughtworks.feature.Factory import com.thoughtworks.deeplearning.plugins._ val hyperparameters = Factory[DoubleTraining with CumulativeINDArrayLayers with INDArrayWeights with ImplicitsSingleton with Operators].newInstance() import hyperparameters.implicits._ val weight = hyperparameters.INDArrayWeight(Nd4j.ones(2, 3)) val indArrayLayer = hyperparameters.INDArrayLayer(weight.forward)
and select one element in the INDArrayLayer,
val doubleLayer: hyperparameters.DoubleLayer = indArrayLayer(0, 2)
when training the selected element, then the data of the element should be 1.0, in the original weight, only the element corresponding to the index get trained.
doubleLayer.train.map { output => output should be(1.0) import org.nd4s.Implicits._ weight.data(0, 0) should be(1.0) weight.data(0, 1) should be(1.0) weight.data(0, 2) should be < 1.0 weight.data(1, 0) should be(1.0) weight.data(1, 1) should be(1.0) weight.data(1, 2) should be(1.0) }