Skip to content

Instantly share code, notes, and snippets.

Avatar

Geoffrey van Driessel geoffreyvd

View GitHub Profile
@geoffreyvd
geoffreyvd / STE.py
Last active Mar 10, 2021
Straight through estimator for tensforflow/keras 2+
View STE.py
@tf.custom_gradient
def binairy_STE_after_sigmoid(x):
def grad(dy):
return dy
result = tf.round(x)
return result, grad
def model():