uke5
This commit is contained in:
parent
001702b010
commit
dbd0506e4c
25
uke5.py
Normal file
25
uke5.py
Normal file
@ -0,0 +1,25 @@
|
||||
import numpy as np
|
||||
|
||||
def relu(y):
|
||||
return np.maximum(0, y)
|
||||
|
||||
def layer(W, x, b):
|
||||
return relu(W @ x + b)
|
||||
|
||||
n = [64,128,128,128,10]
|
||||
|
||||
print(f"Dimensions: {n}")
|
||||
|
||||
# First layer
|
||||
x = np.random.rand(n[0])
|
||||
b = np.random.rand(n[1])
|
||||
y = np.random.rand(128,64)
|
||||
|
||||
y = layer(y, x, b)
|
||||
|
||||
for i in range(2, len(n)):
|
||||
W = np.random.rand(n[i], n[i - 1])
|
||||
b = np.random.rand(n[i])
|
||||
y = layer(W, y, b)
|
||||
|
||||
print(y)
|
Loading…
Reference in New Issue
Block a user