Counts the number of HLO ops with a given op code in the specified module.
| 186 | |
| 187 | // Counts the number of HLO ops with a given op code in the specified module. |
| 188 | static int Count(const HloModule& module, HloOpcode op) { |
| 189 | int count = 0; |
| 190 | for (const auto* computation : module.computations()) { |
| 191 | for (const auto* instruction : computation->instructions()) { |
| 192 | if (instruction->opcode() == op) { |
| 193 | ++count; |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | return count; |
| 198 | } |
| 199 | |
| 200 | TEST_F(InstructionFusionTest, FuseCheapNonDuplicatableOps) { |
| 201 | auto module = ParseAndReturnVerifiedModule(R"( |
no test coverage detected