| 50 | } |
| 51 | |
| 52 | void CreateGraphDef(GraphDef* graph_def, string node_names[3]) { |
| 53 | Graph graph(OpRegistry::Global()); |
| 54 | |
| 55 | Tensor a_tensor(DT_FLOAT, TensorShape({1, 2})); |
| 56 | test::FillValues<float>(&a_tensor, {1.0, 2.0}); |
| 57 | Node* a = test::graph::Constant(&graph, a_tensor); |
| 58 | node_names[0] = a->name(); |
| 59 | |
| 60 | Tensor b_tensor(DT_FLOAT, TensorShape({2, 1})); |
| 61 | test::FillValues<float>(&b_tensor, {2.0, 1.0}); |
| 62 | Node* b = test::graph::Constant(&graph, b_tensor); |
| 63 | node_names[1] = b->name(); |
| 64 | |
| 65 | // c = a * b |
| 66 | Node* c = test::graph::Matmul(&graph, a, b, false, false); |
| 67 | node_names[2] = c->name(); |
| 68 | |
| 69 | test::graph::ToGraphDef(&graph, graph_def); |
| 70 | } |
| 71 | |
| 72 | // Asserts that "val" is a single float tensor. The only float is |
| 73 | // "expected_val". |
no test coverage detected