forward ============== .. js:function:: ConvolutionalLayer.forward() 順伝播 ソース ^^^^^^ .. code-block:: js forward() { var lap = new Lap(this.forwardTime); this.gpuForward(); lap.Time(); if(miniBatchIdx == 0 || Math_random() < 0.01){ var z_gpu_dt = new Float32Array(this.z_.dt); var y_gpu_dt = new Float32Array(this.y_.dt); this.cpuForward(); var max_diff = 0; // 出力先 var output_idx = 0; for (var batch_idx = 0; batch_idx < miniBatchSize; batch_idx++) { for (var channel_idx = 0; channel_idx < this.numChannels; channel_idx++) { for (var r1 = 0; r1 < this.numRows; r1++) { for (var c1 = 0; c1 < this.numCols; c1++) { var diff = Math.max(Math.abs(z_gpu_dt[output_idx] - this.z_.dt[output_idx]), Math.abs(y_gpu_dt[output_idx] - this.y_.dt[output_idx])); if (max_diff < diff) { if(0.001 < diff){ console.log("CNN forward : %dx%d %d %d %d %d %f", this.numRows, this.numCols, batch_idx, channel_idx, r1, c1, diff) } max_diff = diff; } output_idx++; } } } } } lap.Time(); }