(op, grad)
| 51 | |
| 52 | @tf.RegisterGradient('MPScatterMax') |
| 53 | def _ScatterMaxGrad(op, grad): |
| 54 | updates = op.inputs[0] |
| 55 | indices = op.inputs[1] |
| 56 | size = op.inputs[2] |
| 57 | out = op.outputs[0] |
| 58 | indicators = tf.equal(updates, gather(out, indices)) |
| 59 | indicators = tf.cast(indicators, updates.dtype) |
| 60 | num_selected = scatter_add(indicators, indices, size) |
| 61 | indicators = indicators / gather(num_selected, indices) |
| 62 | return [indicators * gather(grad, indices), None, None] |
| 63 | |
| 64 | |
| 65 | def scatter_mean(updates, indices, size=None): |
nothing calls this directly
no test coverage detected