| 61 | } |
| 62 | |
| 63 | TEST(ArrayGradTest, PackGrad) { |
| 64 | Tensor x0(DT_FLOAT, {2, 3}); |
| 65 | x0.flat<float>().setZero(); |
| 66 | Tensor x1(DT_FLOAT, {2, 3}); |
| 67 | x1.flat<float>().setZero(); |
| 68 | Tensor dy(DT_FLOAT, {2, 2, 3}); |
| 69 | test::FillIota<float>(&dy, 0); |
| 70 | auto dx = PackGrad(x0, x1, dy, 0); |
| 71 | test::ExpectClose(dx[0], |
| 72 | test::AsTensor<float>({0., 1., 2., 3., 4., 5.}, {2, 3})); |
| 73 | test::ExpectClose(dx[1], |
| 74 | test::AsTensor<float>({6., 7., 8., 9., 10., 11.}, {2, 3})); |
| 75 | } |
| 76 | |
| 77 | std::vector<Tensor> UnpackGrad(const Tensor& x, const Tensor& dy0, |
| 78 | const Tensor& dy1, int axis) { |
nothing calls this directly
no test coverage detected