You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For high-throughput pipelines (1080p @ 30fps, ML inference), HORUS provides tensor-backed message types that use zero-copy shared memory. These are Pod newtypes around `HorusTensor` — only the 232-byte descriptor flows through the ring buffer while the actual data stays in a shared-memory `TensorPool`.
609
+
610
+
All tensor types live in the `horus_types` crate.
611
+
612
+
### TensorImage
613
+
614
+
Zero-copy camera image with shape `[height, width, channels]`:
All tensor types live in the `horus_types` crate — a leaf crate with zero HORUS dependencies. This is the single source of truth for `HorusTensor`, `TensorDtype`, and `Device`.
The `Device` struct replaces the old `TensorDevice` enum. It's a Pod-safe `repr(C)` struct supporting **unlimited GPU indices**:
68
+
69
+
```rust
70
+
Device::cpu() // CPU / shared memory
71
+
Device::cuda(0) // GPU 0
72
+
Device::cuda(1) // GPU 1
73
+
Device::cuda(7) // GPU 7 — no limit!
74
+
75
+
// Parse from string
76
+
letdev=Device::parse("cuda:2").unwrap();
77
+
letcpu=Device::parse("cpu").unwrap();
78
+
79
+
// Check device type
80
+
assert!(Device::cpu().is_cpu());
81
+
assert!(Device::cuda(0).is_cuda());
82
+
println!("{}", Device::cuda(1)); // "cuda:1"
83
+
```
84
+
85
+
## Auto-Managed Tensor Pools
86
+
87
+
`Topic<HorusTensor>` automatically manages a shared-memory `TensorPool` per topic. Users call `alloc_tensor()`, `send_handle()`, and `recv_handle()` instead of managing pools manually:
letdata=recv_handle.data_slice(); // Zero-copy access to shared memory
113
+
println!("Shape: {:?}", recv_handle.shape());
114
+
println!("Dtype: {:?}", recv_handle.dtype());
115
+
}
116
+
// TensorHandle is RAII — refcount decremented automatically on drop
44
117
```
45
118
46
-
## With TensorPool
119
+
The pool is created lazily on first use and shared across all `Topic<HorusTensor>` instances with the same name — even across processes. Pool IDs are derived deterministically from the topic name.
120
+
121
+
## With Manual TensorPool
122
+
123
+
For advanced use cases, you can manage pools directly:
For common robotics data, HORUS provides zero-overhead Pod wrappers around `HorusTensor` with domain-specific accessors. These use the same zero-copy shared memory path as `HorusTensor` — only the 232-byte descriptor is sent.
146
+
147
+
### TensorImage
148
+
149
+
Camera images with shape `[height, width, channels]`:
0 commit comments