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

Function BM_MklLayoutRewritePass

tensorflow/core/graph/mkl_layout_pass_test.cc:5205–5239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5203}
5204
5205static void BM_MklLayoutRewritePass(int iters, int op_nodes) {
5206 testing::StopTiming();
5207 string s;
5208 for (int in = 0; in < 10; in++) {
5209 s += strings::Printf("node { name: 'in%04d' op: 'Input'}", in);
5210 }
5211 random::PhiloxRandom philox(301, 17);
5212 random::SimplePhilox rnd(&philox);
5213 for (int op = 0; op < op_nodes; op++) {
5214 s += strings::Printf(
5215 "node { name: 'op%04d' op: 'Zeta' attr { key: 'T' value { "
5216 "type: DT_FLOAT } } input: ['in%04d', 'in%04d' ] }",
5217 op, rnd.Uniform(10), rnd.Uniform(10));
5218 }
5219
5220 bool first = true;
5221 while (iters > 0) {
5222 Graph* graph = new Graph(OpRegistry::Global());
5223 InitGraph(s, graph);
5224 int N = graph->num_node_ids();
5225 if (first) {
5226 testing::SetLabel(strings::StrCat("Per graph node. Nodes: ", N));
5227 first = false;
5228 }
5229 {
5230 testing::StartTiming();
5231 std::unique_ptr<Graph> ug(graph);
5232 RunMklLayoutRewritePass(&ug);
5233 testing::StopTiming();
5234 }
5235 iters -= N; // Our benchmark units are individual graph nodes,
5236 // not whole graphs
5237 // delete graph;
5238 }
5239}
5240BENCHMARK(BM_MklLayoutRewritePass)->Arg(1000)->Arg(10000);
5241
5242} // namespace

Callers

nothing calls this directly

Calls 9

StopTimingFunction · 0.85
PrintfFunction · 0.85
SetLabelFunction · 0.85
StartTimingFunction · 0.85
RunMklLayoutRewritePassFunction · 0.85
UniformMethod · 0.80
InitGraphFunction · 0.70
StrCatFunction · 0.50
num_node_idsMethod · 0.45

Tested by

no test coverage detected