| 1222 | } |
| 1223 | |
| 1224 | xla::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 |
no test coverage detected