Skip to content

Commit

Permalink
Coverage tests (flashlight#706)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: flashlight#706

Cover transformer with tests for changing dropout

Reviewed By: jacobkahn

Differential Revision: D30078735

fbshipit-source-id: 5230d8984ef620cb8d6941ff9215e2b4abf69264
  • Loading branch information
Tatiana Likhomanenko authored and facebook-github-bot committed Aug 3, 2021
1 parent 71ac3a7 commit 36595da
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions flashlight/fl/test/contrib/modules/ContribModuleTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ void transformerFwd(bool isfp16) {
ASSERT_EQ(output[0].dims(0), c);
ASSERT_EQ(output[0].dims(1), timesteps);
ASSERT_EQ(output[0].dims(2), batchsize);

tr.setDropout(0);
tr.setLayerDropout(0);
auto output1 = tr.forward({input, padMask}).front();
auto output2 = tr.forward({input, padMask}).front();
ASSERT_TRUE(allClose(output1, output2, 1E-7));
}

TEST(ContribModuleTest, TransformerFwd) {
Expand Down

0 comments on commit 36595da

Please sign in to comment.