@mineproness/tensorloop 2.1.42 → 2.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/gpiInit.js +5 -3
package/package.json
CHANGED
package/src/gpiInit.js
CHANGED
|
@@ -93,7 +93,8 @@ export class GPULinear {
|
|
|
93
93
|
for (let a = 0; a < this.constants.contextSize; a++) {
|
|
94
94
|
sum += out[a][this.thread.y] * input[a][this.thread.x]
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
let grad = Math.max(-1.0, Math.min(1.0, sum))
|
|
97
|
+
return weights[this.thread.y][this.thread.x] - learningRate * grad
|
|
97
98
|
|
|
98
99
|
}, {
|
|
99
100
|
constants: {
|
|
@@ -108,7 +109,8 @@ export class GPULinear {
|
|
|
108
109
|
for (let a = 0; a < this.constants.contextSize; a++) {
|
|
109
110
|
sum += out[a][this.thread.x]
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
let grad = Math.max(-1.0, Math.min(1.0, sum))
|
|
113
|
+
return bias[this.thread.x] - learningRate * grad
|
|
112
114
|
|
|
113
115
|
}, {
|
|
114
116
|
constants: {
|
|
@@ -123,7 +125,7 @@ export class GPULinear {
|
|
|
123
125
|
for (let a = 0; a < this.constants.outputSizes; a++) {
|
|
124
126
|
sum += out[this.thread.y][a] * weights[a][this.thread.x]
|
|
125
127
|
}
|
|
126
|
-
return sum
|
|
128
|
+
return Math.max(-1.0, Math.min(1.0, sum))
|
|
127
129
|
|
|
128
130
|
}, {
|
|
129
131
|
output: [this.embeddingSize, contextSize],
|