Skip to content

Parameter Export

Raul Montoya Cardenas edited this page Jul 29, 2026 · 2 revisions

Parameter Export

Wiki hero

Generated with Grok Build: Grok 4.5 · xAI Imagine (/imagine)

src/fpga_export.rs

Traits

Trait Method Role
FixedPointEncode encode_q88(f32) -> u16 Single value
ParameterExport export() -> FpgaParameters Full bundle
MemFileWriter write_mem_files(dir) Disk layout

Prefer traits when integrating hardware tooling; FpgaParameterExporter is the default concrete type.

FpgaParameterExporter

Builder-style float sources:

  • set_thresholds(Vec<f32>)
  • set_weights(Vec<Vec<f32>>) — neurons × channels
  • set_decay_rates(Vec<f32>)
  • from_params(...) constructor

export() flattens weights row-major into Vec<u16> Q8.8.

FpgaParameters / FpgaMetadata

pub struct FpgaParameters {
    pub thresholds: Vec<u16>,
    pub weights: Vec<u16>,
    pub decay_rates: Vec<u16>,
    pub metadata: FpgaMetadata,
}

Metadata includes:

Field Notes
version EXPORT_FORMAT_VERSION = "Spikenaut-v2" (historical name)
timestamp RFC3339 UTC
num_neurons / num_channels From thresholds / first weight row
target_latency_us 35.0 (design budget)
memory_usage_kb (n_params × 2) / 1024

Related


Last updated: July 29, 2026 Updated by: Grok Build: Grok 4.5 Package tip reference: de069cd (main)

Clone this wiki locally