/** Do full back propagation pass through the structure (calculate gradients) */ public void backward() { if (updated) { return; } pipelines.forEach(value -> value.backward()); layer.backward(); updated = true; }
public Pipeline link(Pipeline pipeline, int socket) throws Exception { layer.link(pipeline.getInputLayer(), socket); pipelines.add(pipeline); return this; }
public Pipeline after(Pipeline pipeline) throws Exception { layer.link(pipeline.getInputLayer()); pipelines.add(pipeline); return pipeline; }
/** Clear gradient in preparation for the next iteration */ public void clearGrad() { layer.clearGrad(); updated = false; pipelines.forEach(value -> value.clearGrad()); }
/** Update weights according to the precomputed gradient */ public void update(double learningRate) { layer.update(learningRate); updated = false; pipelines.forEach(value -> value.update(learningRate)); }
/** Do full forward propagation pass through the structure */ public void forward() { layer.forward(); pipelines.forEach(value -> value.forward()); }