Skip to content

Instantly share code, notes, and snippets.

@primenumber
Created June 28, 2019 05:43
Show Gist options
  • Save primenumber/e3d8b44bad76eef12ce971514ed1cf9d to your computer and use it in GitHub Desktop.
Save primenumber/e3d8b44bad76eef12ce971514ed1cf9d to your computer and use it in GitHub Desktop.
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