| 85 | }; |
| 86 | |
| 87 | TEST(EmbeddingLookupOpTest, SimpleTest) { |
| 88 | EmbeddingLookupSparseOpModel m(CombinerType_SUM, {3}, {3, 2}, {2}, {4, 3, 2}); |
| 89 | m.SetInput({1, 3, 0}, {0, 0, 2, 0, 2, 1}, {3, 2}, {1.0, 2.0, 4.0}); |
| 90 | m.Set3DWeightMatrix( |
| 91 | [](int i, int j, int k) { return i + j / 10.0f + k / 100.0f; }); |
| 92 | m.Invoke(); |
| 93 | |
| 94 | EXPECT_THAT(m.GetOutput(), |
| 95 | ElementsAreArray(ArrayFloatNear({ |
| 96 | 1.00, 1.01, 1.10, 1.11, 1.20, 1.21, // Row 1 |
| 97 | 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, // - |
| 98 | 6.00, 6.06, 6.60, 6.66, 7.20, 7.26, // 2 * Row 3 + 4 * Row 0 |
| 99 | }))); |
| 100 | } |
| 101 | |
| 102 | TEST(EmbeddingLookupOpTest, SimpleTestMean) { |
| 103 | EmbeddingLookupSparseOpModel m(CombinerType_MEAN, {3}, {3, 2}, {2}, |
nothing calls this directly
no test coverage detected