summaryrefslogtreecommitdiff
path: root/src/mind
diff options
context:
space:
mode:
Diffstat (limited to 'src/mind')
-rw-r--r--src/mind/topology.js9
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;
}