MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/lite/kernels/embedding_lookup_sparse_test.cc:87–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85};
86
87TEST(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
102TEST(EmbeddingLookupOpTest, SimpleTestMean) {
103 EmbeddingLookupSparseOpModel m(CombinerType_MEAN, {3}, {3, 2}, {2},

Callers

nothing calls this directly

Calls 6

ArrayFloatNearFunction · 0.70
sqrtFunction · 0.50
SetInputMethod · 0.45
Set3DWeightMatrixMethod · 0.45
InvokeMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected