Created
June 28, 2019 05:43
-
-
Save primenumber/e3d8b44bad76eef12ce971514ed1cf9d to your computer and use it in GitHub Desktop.
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
def relu(x): | |
return max(x, 0) | |
def linear1(x, n): | |
return [x, 2.0 * x - 2 ** n] | |
def linear2(x): | |
return x[0] + -1.0 * x[1] | |
def block(x, n): | |
l1 = linear1(x, n) | |
r = list(map(relu, l1)) | |
return linear2(r) | |
def even_odd(x): | |
for i in range(24, 0, -1): | |
x = block(x, i) | |
return x | |
for i in range(100): | |
print(i, even_odd(i)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment