Ternary operation use threshold computed with weights.
(x)
| 382 | |
| 383 | |
| 384 | def 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 ########## |
no test coverage detected
searching dependent graphs…