| 25 | // into a scalar. |
| 26 | template <typename T> |
| 27 | static Graph* ToScalar(const string& reduce, int num_x, int num_y) { |
| 28 | auto* g = new Graph(OpRegistry::Global()); |
| 29 | Tensor data(DataTypeToEnum<T>::value, TensorShape({num_x, num_y})); |
| 30 | data.flat<T>().setRandom(); |
| 31 | Tensor axes(DT_INT32, TensorShape({2})); |
| 32 | axes.flat<int32>()(0) = 0; |
| 33 | axes.flat<int32>()(1) = 1; |
| 34 | test::graph::Reduce(g, reduce, test::graph::Constant(g, data), |
| 35 | test::graph::Constant(g, axes)); |
| 36 | return g; |
| 37 | } |
| 38 | |
| 39 | static Graph* ColReduce(const string& reduce, int num_x, int num_y) { |
| 40 | auto* g = new Graph(OpRegistry::Global()); |
no test coverage detected