Skip to main content
. 2021 Sep 9;21(18):6050. doi: 10.3390/s21186050
Listing 1. Pseudo-code for the C/C++ template used for a DNN layer.
// Multiply the bias value by the weight of j-th neuron
for j = 1 to N_Output
 B[j] = Wb[j] ∗ b
end

// Multiply and accumulate layer weights for all neurons
for i = 1 to N_Input
for j = 1 to N_Output
  X[j] = X[j] + x[i] ∗ W[j]
end
end

// Add weighted bias and weighted neurons and produce output neurons
// result via activation function
for j = 1 to N_Output
 y[j] = f(X[j]+B[i])  // activation function of each neuron at k-th layer
end