| 50 | }; |
| 51 | |
| 52 | TEST_F(DynamicPartitionOpTest, Simple_OneD) { |
| 53 | MakeOp(); |
| 54 | |
| 55 | TF_ASSERT_OK(InitOp()); |
| 56 | // Similar to how we would use this to split embedding ids to be looked up |
| 57 | |
| 58 | // Feed and run |
| 59 | AddInputFromArray<float>(TensorShape({6}), {0, 13, 2, 39, 4, 17}); |
| 60 | AddInputFromArray<int32>(TensorShape({6}), {0, 0, 2, 3, 2, 1}); |
| 61 | TF_ASSERT_OK(RunOpKernel()); |
| 62 | |
| 63 | // Check the output sizes |
| 64 | { // Output 0 |
| 65 | Tensor expected(allocator(), DT_FLOAT, TensorShape({2})); |
| 66 | test::FillValues<float>(&expected, {0, 13}); |
| 67 | test::ExpectTensorEqual<float>(expected, *GetOutput(0)); |
| 68 | } |
| 69 | { // Output 1 |
| 70 | Tensor expected(allocator(), DT_FLOAT, TensorShape({1})); |
| 71 | test::FillValues<float>(&expected, {17}); |
| 72 | test::ExpectTensorEqual<float>(expected, *GetOutput(1)); |
| 73 | } |
| 74 | { // Output 2 |
| 75 | Tensor expected(allocator(), DT_FLOAT, TensorShape({2})); |
| 76 | test::FillValues<float>(&expected, {2, 4}); |
| 77 | test::ExpectTensorEqual<float>(expected, *GetOutput(2)); |
| 78 | } |
| 79 | { // Output 3 |
| 80 | Tensor expected(allocator(), DT_FLOAT, TensorShape({1})); |
| 81 | test::FillValues<float>(&expected, {39}); |
| 82 | test::ExpectTensorEqual<float>(expected, *GetOutput(3)); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | TEST_F(DynamicPartitionOpTest, gpu_Simple_OneD) { |
| 87 | MakeOp(); |
nothing calls this directly
no test coverage detected