diff options
author | sanine <sanine.not@pm.me> | 2023-11-12 15:18:29 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-11-12 15:18:29 -0600 |
commit | 7825b92ce3be95a0ce1dfea9388adbaadce83b1f (patch) | |
tree | eb1e38561e3aba4b890e666e04d46e4de499658e /src/mind/topology.js | |
parent | 95fd952b6d4c496efc0e6236ba2acfcbbeee8ed9 (diff) |
fix bugs
Diffstat (limited to 'src/mind/topology.js')
-rw-r--r-- | src/mind/topology.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mind/topology.js b/src/mind/topology.js index 9f2569d..946dd86 100644 --- a/src/mind/topology.js +++ b/src/mind/topology.js @@ -131,6 +131,13 @@ function get_value(n, index, input, prev, cache) { const sum = values // compute the weighted sum of the values .reduce((acc, x, i) => acc + (weight[i] * x), 0); + if (sum !== sum) { // NaN test + console.log(n); + console.log(sources); + console.log(input); + throw new Error(`failed to get output for index ${index}`); + } + // compute result const value = Math.tanh(sum); @@ -139,7 +146,7 @@ function get_value(n, index, input, prev, cache) { if (cache !== undefined) { cache[index] = value; } - + return value; } |