Skip to main content
. 2025 Jun 19;25(12):3829. doi: 10.3390/s25123829
Algorithm 1 RBG Neural Network
Input:
X ∈ ℝ^(T×d_in)    // Input sequence of length T with d_in features
n_layers = 6       // Total number of stacked layers
d_hidden        // Hidden state dimension
training_flag     // Boolean for train/inference mode
Output:
y ∈ ℝ^(T×d_out)    // Output sequence
1: // Initialization
2: for l ← 1 to n_layers do
3:    if l ≤ 2 then
4:      W_gru[l] ← Initialize GRU Weights(d_hidden)
5:    else
6:      W_bn[l] ← Initialize BatchNorm Params()
7:      W_gru[l] ← Initialize Bi-GRU Weights(d_hidden)
8:    end if
9: end for
10: // Forward pass
11: h ← X
12: for l ← 1 to n_layers do
13:    if l > 2 then
14:      h ← BatchNorm(h, W_bn[l], training_flag)
15:    end if
16:    h ← ReLU(h)  // Element-wise activation
17:    if l ≤ 2 then
18:      h ← GRU(h, W_gru[l])  // Unidirectional GRU
19:    else
20:      h ← BiGRU(h, W_gru[l])  // Bidirectional GRU
21:    end if
22: end for
23: y ← LinearProjection(h)  // Final output layer
24: return y