gpuForward

FullyConnectedLayer.gpuForward()

GPUによる順伝播

\[ \begin{align}\begin{aligned}z_{i} = \displaystyle \sum_{j }^{ X } x_{j} \cdot weight_{i,j} + bias_{i}\\y_{i} = σ(z_{i})\end{aligned}\end{align} \]

ソース

gpuForward(){
    var vertex_shader = Shaders.FullyConnectedLayer_Forward;

    this.param = {
        id : "Fully-Connected-Layer-forward," + miniBatchSize + "," + this.prevLayer.unitSize + "," + this.unitSize,
        vertexShader: vertex_shader,
        args : {
            "activationFunction": this.activationFunction,
            "zero": this.outZero,
            "X": WebGL2.makeTextureInfo("float", [ miniBatchSize, this.prevLayer.unitSize], this.prevLayer.y_.dt),
            "W": WebGL2.makeTextureInfo("float", this.weight.shape, this.weight.dt),
            "Bias": WebGL2.makeTextureInfo("float", [ 1, this.bias.dt.length ], this.bias.dt),
            "z": this.z_.dt,
            "y" : this.y_.dt
        }
    };

    WebGL2.compute(this.param);
}