Skip to content

Commit

Permalink
modded relu6 dfx
Browse files Browse the repository at this point in the history
  • Loading branch information
ago109 committed Jul 21, 2024
1 parent b74683f commit 0c71914
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ngclearn/utils/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def d_relu6(x):
"""
# df/dx = 1 if 0<x<6 else 0
# I_x = (z >= a_min) *@ (z <= b_max) //create an indicator function a = 0 b = 6
Ix1 = (x > 0.).astype(jnp.float32) #tf.cast(tf.math.greater_equal(x, 0.0),dtype=tf.float32)
Ix1 = (x >= 0.).astype(jnp.float32) #tf.cast(tf.math.greater_equal(x, 0.0),dtype=tf.float32)
Ix2 = (x <= 6.).astype(jnp.float32) #tf.cast(tf.math.less_equal(x, 6.0),dtype=tf.float32)
Ix = Ix1 * Ix2
return Ix
Expand Down

0 comments on commit 0c71914

Please sign in to comment.