cpuDeltaZ¶
-
AffineTransformationLayer.
cpuDeltaZ
()¶ CPUによるδzの計算
ソース¶
cpuDeltaZ(){
// 活性化関数
switch(this.activationFunction){
case ActivationFunction.none:
for (var i = 0; i < this.deltaZ.dt.length; i++) {
this.deltaZ.dt[i] = this.deltaY.dt[i];
}
break;
case ActivationFunction.sigmoid:
for (var i = 0; i < this.deltaZ.dt.length; i++) {
this.deltaZ.dt[i] = this.deltaY.dt[i] * sigmoid_prime(this.z_.dt[i]);
}
break;
case ActivationFunction.ReLU:
for (var i = 0; i < this.deltaZ.dt.length; i++) {
this.deltaZ.dt[i] = (this.z_.dt[i] <= 0 ? 0 : this.deltaY.dt[i]);
}
break;
}
}