1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! # sensorlm-rs
//!
//! A complete Rust implementation of the **SensorLM** sensor-language foundation
//! model (NeurIPS 2025) using the [Burn](https://burn.dev) deep-learning framework.
//!
//! ## Backend selection
//!
//! By default this crate uses the **NdArray** (CPU) backend. Enable the WGPU
//! (GPU) backend by building with the `wgpu` feature:
//!
//! ```bash
//! cargo build --features wgpu
//! ```
//!
//! ## Architecture overview
//!
//! ```text
//! ┌────────────────────────────────────────┐
//! Raw wearable data │ SensorLM (Two-Tower) │
//! (1440 × 34 × 1) │ │
//! │ │ ┌──────────────┐ SigLIP loss │
//! ▼ │ │ SensorEncoder│──────────────────┐ │
//! Normalise / mask │ │ (ViT-B/10/2)│ │ │
//! │ │ │ MAP pooling │ │ │
//! │ │ └──────────────┘ contrastive │ │
//! │ │ 768-dim alignment │ │
//! │ │ ▼ │
//! Caption pipeline ──▶ │ ┌──────────────┐ ┌─────────────────┐│
//! (stat/struct/semantic)│ │ TextEncoder │ │ temperature ││
//! │ │ (Transformer│ │ + bias scalars ││
//! │ │ 12 layers) │ └─────────────────┘│
//! │ └──────────────┘ │
//! └────────────────────────────────────────┘
//! ```
// ---------------------------------------------------------------------------
// Backend type aliases
// ---------------------------------------------------------------------------
/// NdArray (CPU) backend for inference and testing.
pub type CpuBackend = NdArray;
/// Autodiff wrapper over NdArray for CPU training / unit tests.
pub type CpuTrainBackend = Autodiff;
// WGPU backend aliases (only available with `wgpu` feature).
/// WGPU backend for GPU inference (no autodiff).
pub type WgpuBackend = Wgpu;
/// Autodiff wrapper over WGPU for GPU training.
pub type TrainBackend = Autodiff;