Chief Nazari needs to process the raw signal data.
Raw data is useless. We need to clean it, combine sensor feeds, and amplify the signal. Every operation needs to be fast — we're processing millions of data points per second.
You've used Array.map() to transform lists, reduce() to aggregate values, and spread operators to combine arrays. Tensor operations are the same ideas — but they run on the GPU and handle millions of elements in parallel.
When you write arr.map((x, i) => x + arr2[i]), you're doing element-wise addition. TensorFlow.js does the same thing, but across any number of dimensions and on the GPU:
Matrix multiplication (matMul) is the operation that makes neural networks work. Every layer in a neural network is essentially: output = matMul(input, weights) + bias. You'll see this pattern everywhere from here on.
Add two tensors together to combine sensor readings.