MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / _sign

Function _sign

examples/DoReFa-Net/dorefa.py:29–30  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

27
28 @tf.custom_gradient
29 def _sign(x):
30 return tf.where(tf.equal(x, 0), tf.ones_like(x), tf.sign(x / E)) * E, lambda dy: dy
31
32 return _sign(x)
33

Callers 1

fwFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…