Compute flops for Softmax operation.
(graph, node)
| 123 | |
| 124 | @ops.RegisterStatistics("Softmax", "flops") |
| 125 | def _softmax_flops(graph, node): |
| 126 | """Compute flops for Softmax operation.""" |
| 127 | # Softmax implenetation: |
| 128 | # |
| 129 | # Approximate flops breakdown: |
| 130 | # 2*n -- compute shifted logits |
| 131 | # n -- exp of shifted logits |
| 132 | # 2*n -- compute softmax from exp of shifted logits |
| 133 | return _unary_op_flops(graph, node, ops_per_element=5) |
| 134 | |
| 135 | ################################################################################ |
| 136 | # Binary operations |
nothing calls this directly
no test coverage detected