Skip to content

Commit

Permalink
Add dot function for good measure
Browse files Browse the repository at this point in the history
  • Loading branch information
tekknolagi committed Sep 23, 2023
1 parent 416040e commit 1daf1aa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions _posts/2023-09-19-compiling-ml-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,9 @@ nice speedup.
The code for compiling a `Dot` node is not that tricky:

```python
def dot(l, r):
return sum(li.data*ri.data for li,ri in zip(l,r))

class Dot(Value):
def __init__(self, left_arr, right_arr):
assert len(left_arr) == len(right_arr)
Expand Down

0 comments on commit 1daf1aa

Please sign in to comment.