MojoLlama
Archived Mojo/MAX quantizer and serving research repository (read-only history)
Brought by drakestapleton
MojoLlama / src / mojollama / mojo_engine / test_here.mojo
| 1 | from std import time |
| 2 | |
| 3 | def test_fn(out: Span[Float32, _], w: Span[UInt8, _], n: Int): |
| 4 | for i in range(n): out[i] = Float32(w[i]) |
| 5 | |
| 6 | def main(): |
| 7 | var a = alloc[Float32](4) |
| 8 | var b = alloc[UInt8](4) |
| 9 | for i in range(4): b.store(i, UInt8(i * 3)) |
| 10 | var sa = Span[Float32, _](ptr=a, length=4) |
| 11 | var sb = Span[UInt8, _](ptr=b, length=4) |
| 12 | test_fn(sa, sb, 4) |
| 13 | for i in range(4): print(i, sa[i]) |
| 14 | a.free(); b.free() |