init

FullyConnectedLayer.init(prev_layer)

初期処理

引数:
  • prev_layer (Layer) – 直前のレイヤー

ソース

init(prev_layer) {
    super.init(prev_layer);

    this.bias = random.randn(this.unitSize, 1);
    this.weight = random.randn(this.unitSize, this.prevLayer.unitSize);

    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.deltaWeight = new ArrayView(this.unitSize, this.prevLayer.unitSize);
}