()
| 61 | } |
| 62 | |
| 63 | buildRunInput() { |
| 64 | let weightedSum = null; |
| 65 | |
| 66 | switch (this.activation) { |
| 67 | case 'sigmoid': |
| 68 | weightedSum = weightedSumSigmoid; |
| 69 | break; |
| 70 | case 'relu': |
| 71 | weightedSum = weightedSumRelu; |
| 72 | break; |
| 73 | case 'leaky-relu': |
| 74 | weightedSum = weightedSumLeakyRelu; |
| 75 | break; |
| 76 | case 'tanh': |
| 77 | weightedSum = weightedSumTanh; |
| 78 | break; |
| 79 | default: |
| 80 | throw new Error('unknown activation ' + this.activation); |
| 81 | } |
| 82 | |
| 83 | for(let layer = 1; layer <= this.outputLayer; layer++){ |
| 84 | this.forwardPropagate[layer] = this.gpu.createKernel(weightedSum, { |
| 85 | output: [this.sizes[layer]], |
| 86 | outputToTexture: true, |
| 87 | hardcodeConstants: true, |
| 88 | constants: { |
| 89 | size: this.sizes[layer - 1] |
| 90 | } |
| 91 | }); |
| 92 | } |
| 93 | |
| 94 | this._texturizeInputData = this.gpu.createKernel(function(value) { |
| 95 | return value[this.thread.x]; |
| 96 | }, { |
| 97 | output: [this.sizes[1]], |
| 98 | outputToTexture: true, |
| 99 | hardcodeConstants: true, |
| 100 | outputImmutable: true |
| 101 | }); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * |
no outgoing calls
no test coverage detected