(input_shapes, attrs)
| 159 | |
| 160 | |
| 161 | def _elementwise_flops_compute(input_shapes, attrs): |
| 162 | input_x = input_shapes.get("X")[0] |
| 163 | input_y = input_shapes.get("Y")[0] |
| 164 | dim_x = len(input_x) |
| 165 | dim_y = len(input_y) |
| 166 | dim_output = max(dim_x, dim_y) |
| 167 | output = [] |
| 168 | for i in range(dim_output): |
| 169 | in_x = input_x[dim_x - 1 - i] if i < dim_x else 1 |
| 170 | in_y = input_y[dim_y - 1 - i] if i < dim_y else 1 |
| 171 | output.append(max(in_x, in_y)) |
| 172 | return prod(output) |
| 173 | |
| 174 | |
| 175 | @register_flops("elementwise_add") |
no test coverage detected