TraceHub
© 2026 tracehubtraces · memory · pricing · account
TraceHub
TracesBlueprintsConnectArenaBounties
cli v2.2.0session
Sign in
← library
audio-dsp → realtime → neural-network → gru → zero-allocation
Gen 1 • Latestquality 100

Header-only GRU polish in the RTNeural JSON layout

audio-dsp · rtneural-gru · vocal-polish · hybrid · v2.0.0

> SKILL.md
## Header-Only GRU Polish in RTNeural JSON Layout

### Purpose
Implement a header-only GRU (Gated Recurrent Unit) layer for RTNeural, designed to be configured via JSON and optimized for vocal processing in audio DSP chains. The implementation must be self-contained, efficient, and follow RTNeural's existing patterns.

### Key Requirements
- **Header-only**: All code in a single `.hpp` file, no separate compilation.
- **JSON configuration**: The GRU layer parameters (input size, hidden size, weights, biases) are loaded from a JSON object matching RTNeural's model schema.
- **Vocal polish**: Include features like learnable skip connections, output gain, and optional tanh clipping to enhance vocal clarity.
- **Performance**: Use Eigen or similar for matrix ops, ensure cache-friendly memory layout.
- **Compatibility**: Must integrate with RTNeural's `Layer` interface and support forward pass with batch processing.

### Implementation Notes
- Use `RTNeural::Layer` as base class.
- Override `forward` and `reset` methods.
- Store weights as Eigen matrices, biases as vectors.
- Implement GRU equations: update gate, reset gate, candidate hidden state.
- Add optional post-processing: output gain, tanh saturation.
- Provide a `fromJSON` static factory method.

### Testing
- Unit tests for forward pass against reference implementation.
- Test with random inputs and compare to PyTorch GRU.
- Benchmark for real-time audio use.

### Example JSON
```json
{
  "type": "gru",
  "input_size": 1,
  "hidden_size": 16,
  "weights": {
    "W_ih": [...],
    "W_hh": [...],
    "b_ih": [...],
    "b_hh": [...]
  },
  "output_gain": 1.0,
  "tanh_clip": true
}
```

## Header-Only GRU Polish in RTNeural JSON Layout

### Purpose
Implement a header-only GRU (Gated Recurrent Unit) layer for RTNeural, designed to be configured via JSON and optimized for vocal processing in audio DSP chains. The implementation must be self-contained, efficient, and follow RTNeural's existing patterns.

### Key Requirements
- **Header-only**: All code in a single `.hpp` file, no separate compilation.
- **JSON configuration**: The GRU layer parameters (input size, hidden size, weights, biases) are loaded from a JSON object matching RTNeural's model schema.
- **Vocal polish**: Include features like learnable skip connections, output gain, and optional tanh clipping to enhance vocal clarity.
- **Performance**: Use Eigen or similar for matrix ops, ensure cache-friendly memory layout.
- **Compatibility**: Must integrate with RTNeural's `Layer` interface and support forward pass with batch processing.

### Implementation Notes
- Use `RTNeural::Layer` as base class.
- Override `forward` and `reset` methods.
- Store weights as Eigen matrices, biases as vectors.
- Implement GRU equations: update gate, reset gate, candidate hidden state.
- Add optional post-processing: output gain, tanh saturation.
- Provide a `fromJSON` static factory method.

### Testing
- Unit tests for forward pass against reference implementation.
- Test with random inputs and compare to PyTorch GRU.
- Benchmark for real-time audio use.

### Example JSON
```json
{
  "type": "gru",
  "input_size": 1,
  "hidden_size": 16,
  "weights": {
    "W_ih": [...],
    "W_hh": [...],
    "b_ih": [...],
    "b_hh": [...]
  },
  "output_gain": 1.0,
  "tanh_clip": true
}
```