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

Function Optimize

tensorflow/core/common_runtime/function_test.cc:1869–1885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1867bool DoNothing(Graph* g) { return false; }
1868
1869GraphDef Optimize(const std::function<bool(Graph* g)>& pass,
1870 const FunctionDef& fdef) {
1871 InstantiationResult result;
1872 TF_CHECK_OK(InstantiateFunction(fdef, AttrSlice(), GetOpSig, &result));
1873 std::unique_ptr<Graph> g(new Graph(OpRegistry::Global()));
1874 GraphConstructorOptions opts;
1875 opts.allow_internal_ops = true;
1876 opts.expect_device_spec = false;
1877 TF_CHECK_OK(ConvertNodeDefsToGraph(opts, result.nodes, g.get()));
1878 pass(g.get());
1879 std::unique_ptr<Graph> g1(new Graph(OpRegistry::Global()));
1880 CopyGraph(*g, g1.get());
1881 g = nullptr;
1882 GraphDef gdef;
1883 g1->ToGraphDef(&gdef);
1884 return gdef;
1885}
1886
1887} // end namespace
1888

Callers 2

TESTFunction · 0.70
OptimizeMethod · 0.70

Calls 6

InstantiateFunctionFunction · 0.85
AttrSliceClass · 0.85
ConvertNodeDefsToGraphFunction · 0.85
CopyGraphFunction · 0.50
getMethod · 0.45
ToGraphDefMethod · 0.45

Tested by

no test coverage detected