tensorflow/lite/kernels/embedding_lookup_test.cc
// TODO(ahentz): write more tests that exercise the details of the op, such as
// lookup errors and variable input shapes.
write more tests that exercise the details of the op, such as
lookup errors and variable input shapes.
write more tests that exercise the details of the op such as lookup errors and variable input shapes .
TEST(EmbeddingLookupOpTest, SimpleTest) {
  EmbeddingLookupOpModel m({3}, {3, 2, 4});
  m.SetInput({1, 0, 2});
  m.Set3DWeightMatrix<float>(
      [](int i, int j, int k) -> float { return i + j / 10.0f + k / 100.0f; });
  m.Invoke();
  EXPECT_THAT(m.GetOutput<float>(),
              ElementsAreArray(ArrayFloatNear({
                  1.00, 1.01, 1.02, 1.03, 1.10, 1.11, 1.12, 1.13,  
                  0.00, 0.01, 0.02, 0.03, 0.10, 0.11, 0.12, 0.13,  
                  2.00, 2.01, 2.02, 2.03, 2.10, 2.11, 2.12, 2.13,  
              })));
}
TEST ( EmbeddingLookupOpTest , SimpleTest ) { EmbeddingLookupOpModel m ( { 3 } , { 3 , 2 , 4 } ) ; m . SetInput ( { 1 , 0 , 2 } ) ; m . Set3DWeightMatrix < float > ( [ ] ( int i , int j , int k ) -> float { return i + j / 10.0f + k / 100.0f ; } ) ; m . Invoke ( ) ; EXPECT_THAT ( m . GetOutput < float > ( ) , ElementsAreArray ( ArrayFloatNear ( { 1.00 , 1.01 , 1.02 , 1.03 , 1.10 , 1.11 , 1.12 , 1.13 , 0.00 , 0.01 , 0.02 , 0.03 , 0.10 , 0.11 , 0.12 , 0.13 , 2.00 , 2.01 , 2.02 , 2.03 , 2.10 , 2.11 , 2.12 , 2.13 , } ) ) ) ; }
TODO(ahentz): write more tests that exercise the details of the op, such as
lookup errors and variable input shapes.
TODO ( ahentz ) : write more tests that exercise the details of the op such as lookup errors and variable input shapes .
// Row 1 // Row 0 // Row 2