Skip to content

Commit

Permalink
[system-a] linear
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed May 25, 2024
1 parent c8c4a68 commit eca77ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# system-a

[system-a] `linear`
[system-a] test `linear`
[system-a] `relu`

# the-book

Expand Down
7 changes: 7 additions & 0 deletions src/system-a/toys/linear.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { Tensor } from "../tensor/index.js"
import { dot } from "./dot.js"
import { add } from "./toys.js"

export function linear(t: Tensor): (weight: Tensor, bias: Tensor) => Tensor {
return (weight, bias) => add(dot(weight, t), bias)
}

0 comments on commit eca77ab

Please sign in to comment.