| 226 | } |
| 227 | |
| 228 | Tensor ReduceSum(const Tensor& x, gtl::ArraySlice<int32> axes) { |
| 229 | int num_axes = axes.length(); |
| 230 | Tensor y(DT_INT32, TensorShape({num_axes})); |
| 231 | for (size_t i = 0; i < axes.size(); ++i) { |
| 232 | y.flat<int32>()(i) = axes[i]; |
| 233 | } |
| 234 | auto T = x.dtype(); |
| 235 | auto gdef = test::function::GDef( |
| 236 | { |
| 237 | f::NDef("x", "Placeholder", {}, {{"dtype", T}}), |
| 238 | f::NDef("y", "Const", {}, {{"dtype", DT_INT32}, {"value", y}}), |
| 239 | f::NDef("z", "Sum", {"x", "y"}, {{"T", T}}), |
| 240 | }, |
| 241 | {}); |
| 242 | auto sess = NewSession(); |
| 243 | TF_CHECK_OK(sess->Create(gdef)); |
| 244 | std::vector<Tensor> outputs; |
| 245 | TF_CHECK_OK(sess->Run({{"x:0", x}}, {"z:0"}, {}, &outputs)); |
| 246 | CHECK_EQ(outputs.size(), 1); |
| 247 | TF_CHECK_OK(sess->Close()); |
| 248 | return outputs[0]; |
| 249 | } |
| 250 | |
| 251 | Tensor MatMulCommon(const string& opname, const string& attr_adj_x, |
| 252 | const string& attr_adj_y, const Tensor& x, bool ax, |
nothing calls this directly
no test coverage detected