MCPcopy Index your code
hub / github.com/tensorlayer/TensorLayer / ternary_operation

Function ternary_operation

tensorlayer/layers/utils.py:384–390  ·  view source on GitHub ↗

Ternary operation use threshold computed with weights.

(x)

Source from the content-addressed store, hash-verified

382
383
384def ternary_operation(x):
385 """Ternary operation use threshold computed with weights."""
386 g = tf.compat.v1.get_default_graph()
387 with g.gradient_override_map({"Sign": "Identity"}):
388 threshold = _compute_threshold(x)
389 x = tf.sign(tf.add(tf.sign(tf.add(x, threshold)), tf.sign(tf.add(x, -threshold))))
390 return x
391
392
393########## Module Private Functions ##########

Callers 2

forwardMethod · 0.90
forwardMethod · 0.90

Calls 2

_compute_thresholdFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…