backpropagation¶
-
FullyConnectedLayer.
backpropagation
()¶ 誤差逆伝播
ソース¶
backpropagation() {
var lap = new Lap(this.backwardTime);
if (this.nextLayer) {
// 最後のレイヤーでない場合
this.deltaY = this.nextLayer.deltaX;
}
this.cpuDeltaZ();
lap.Time();
this.deltaBias = this.deltaZ.Reduce((x, y) => x + y);
lap.Time();
this.gpuDeltaWeight();
lap.Time();
if(! (this.prevLayer instanceof InputLayer)){
this.gpuDeltaX();
if(Math_random() < 0.01){
var gpu_delta_x = new Float32Array(this.deltaX.dt);
this.cpuDeltaX();
var diff = this.deltaX.diff(gpu_delta_x);
// Assert(diff < 0.01, "delta-X");
if(0.01 < diff){
console.log("dense delta-X %f", diff)
}
}
}
lap.Time();
}