@mineproness/tensorloop 1.3.0 → 1.3.1
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/Linear/index.d.ts +1 -0
- package/src/Linear/index.js +15 -12
- package/src.zip +0 -0
package/package.json
CHANGED
package/src/Linear/index.d.ts
CHANGED
package/src/Linear/index.js
CHANGED
|
@@ -55,19 +55,22 @@ export class Linear {
|
|
|
55
55
|
}
|
|
56
56
|
return output
|
|
57
57
|
}
|
|
58
|
-
backward(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
backward(outputGradient, learningRate) {
|
|
59
|
+
const input = this.input[idx];
|
|
60
|
+
const weights = this.Weights
|
|
61
|
+
const inputGradient = new Float32Array(input.length)
|
|
62
|
+
for (let a = 0; a < weights.length; a++) {
|
|
63
|
+
const gran = outputGradient[a]
|
|
64
|
+
const w = weights[a]
|
|
65
|
+
for (let at = 0; at < input.length; at++) {
|
|
66
|
+
inputGradient[at] += gran * w[at]
|
|
67
|
+
w[at] -= learningRate * input[at] * gran
|
|
65
68
|
}
|
|
66
|
-
|
|
69
|
+
this.Bias[a] -= learningRate * gran
|
|
67
70
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
return inputGradient
|
|
72
|
+
}
|
|
73
|
+
ClearInputCache(){
|
|
74
|
+
this.input = []
|
|
72
75
|
}
|
|
73
76
|
}
|
package/src.zip
DELETED
|
Binary file
|