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

Function BuildTestGraph

tensorflow/compiler/tf2xla/xla_compiler_test.cc:1224–1237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1222}
1223
1224xla::StatusOr<std::unique_ptr<Graph>> BuildTestGraph() {
1225 Scope scope = Scope::NewRootScope().ExitOnError();
1226 auto a = ops::_Arg(scope.WithOpName("A"), DT_INT32, 0);
1227 auto var = ops::_Arg(scope.WithOpName("V"), DT_RESOURCE, 1);
1228 auto write = ops::AssignAddVariableOp(scope, var, a);
1229 auto read = ops::ReadVariableOp(
1230 scope.WithControlDependencies(std::vector<Operation>{write}), var,
1231 DT_INT32);
1232 auto read_plus_one = ops::Add(scope, read, ops::Const<int32>(scope, 1));
1233 auto d = ops::_Retval(scope.WithOpName("D"), read_plus_one, 0);
1234 std::unique_ptr<Graph> graph(new Graph(OpRegistry::Global()));
1235 TF_RETURN_IF_ERROR(scope.ToGraph(graph.get()));
1236 return std::move(graph);
1237}
1238
1239// Tests a simple graph that reads and writes a variable, with a
1240// shape_representation_fn passed to the compiler that flattens all

Callers 1

TEST_FFunction · 0.85

Calls 8

ExitOnErrorMethod · 0.80
WithOpNameMethod · 0.80
ToGraphMethod · 0.80
AssignAddVariableOpClass · 0.50
ReadVariableOpClass · 0.50
AddClass · 0.50
getMethod · 0.45

Tested by

no test coverage detected