init ======== .. js:function:: ConvolutionalLayer.init(prev_layer) 初期処理 :param Layer prev_layer: 直前のレイヤー ソース ^^^^^^ .. code-block:: js init(prev_layer) { super.init(prev_layer); this.numRows = this.prevLayer.numRows - this.filterSize + 1; this.numCols = this.prevLayer.numCols - this.filterSize + 1; this.unitSize = this.numChannels * this.numRows * this.numCols; this.bias = new ArrayView(this.numChannels); for (var i = 0; i < this.bias.dt.length; i++) { this.bias.dt[i] = random.randn(); } this.weight = new ArrayView(this.numChannels, prev_layer.numChannels, this.filterSize, this.filterSize); for (var i = 0; i < this.weight.dt.length; i++) { this.weight.dt[i] = random.randn(); } if(this.activationFunction == ActivationFunction.ReLU){ var sd = Math.sqrt(2.0 / prev_layer.unitSize); for(var i = 0; i < this.weight.dt.length; i++){ this.weight.dt[i] *= sd; } } this.deltaBias = new ArrayView(this.numChannels); this.deltaWeight = new ArrayView(this.numChannels, prev_layer.numChannels, this.filterSize, this.filterSize); }