Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-bridge/blob/main/pytorch/kernels/linear.om # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-bridge / pytorch / kernels / linear.om` 21 lines ยท 666 bytes Raw Blame History 1 note linear: o[M,N] = c[N] + a[M,K] @ w[N,K]^T, the addmm of a torch.nn.Linear whose weight transpose 2 note (aten.permute [1,0]) feeds only this addmm; w is read in place, nothing is copied. Each sum starts 3 note at the bias, is summed in f64 and rounded once to f32. Consts M K N MK NK MN come first. 4 fn lindot c view f32 N a view f32 MK w view f32 NK i ulong j ulong to f64 5 s = f64 get c j 6 ia = mul i K 7 iw = mul j K 8 for k ulong K 9 s = add s mul f64 get a ia f64 get w iw 10 ia = add ia 1 11 iw = add iw 1 12 end 13 ret s 14 end 15 fn linear c view f32 N a view f32 MK w view f32 NK o edit f32 MN to void 16 for i ulong M 17 for j ulong N 18 put o add mul i N j f32 lindot c a w i j 19 end 20 end 21 end