| 572 | } |
| 573 | |
| 574 | void BM_ForEach(int iters, int depth, int fan_out) { |
| 575 | tensorflow::testing::StopTiming(); |
| 576 | Shape shape = ShapeUtil::MakeShape(F32, {32, 64, 128}); |
| 577 | for (int i = 0; i < depth; ++i) { |
| 578 | std::vector<xla::Shape> shapes(fan_out, shape); |
| 579 | shape = ShapeUtil::MakeTupleShape(shapes); |
| 580 | } |
| 581 | tensorflow::testing::StartTiming(); |
| 582 | |
| 583 | ShapeTree<int> shape_tree(shape); |
| 584 | for (int i = 0; i < iters; ++i) { |
| 585 | shape_tree.ForEachMutableElement([](const ShapeIndex& index, int* data) { |
| 586 | tensorflow::testing::DoNotOptimize(index); |
| 587 | }); |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | void BM_Iterate(int iters, int depth, int fan_out) { |
| 592 | tensorflow::testing::StopTiming(); |
nothing calls this directly
no test coverage detected