Created
September 8, 2022 19:54
-
-
Save harpone/c5fe6241960f8a84d0d91f919b62be04 to your computer and use it in GitHub Desktop.
Serial 1 layer NN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SERIAL: | |
W = parameter(M, N) | |
def forward(x_: float32[N]) -> float32: | |
# matrix-vector multiplication: | |
zs = float32[M] # let's imagine we have a float32 dtype in Vyper | |
for i, W_row in enumerate(W): | |
zs[i] = dot(W_row, x_) # 'dot' is an external smart contract | |
# summation: | |
y = sum(zs) # scalar | |
return y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment