MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / BM_ForEach

Function BM_ForEach

tensorflow/compiler/xla/shape_tree_test.cc:574–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572}
573
574void 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
591void BM_Iterate(int iters, int depth, int fan_out) {
592 tensorflow::testing::StopTiming();

Callers

nothing calls this directly

Calls 5

StopTimingFunction · 0.85
MakeShapeFunction · 0.85
StartTimingFunction · 0.85
DoNotOptimizeFunction · 0.85
ForEachMutableElementMethod · 0.45

Tested by

no test coverage detected