Skip to content

Commit

Permalink
fix rnn test
Browse files Browse the repository at this point in the history
Change-Id: I25f80a4f965e820d7d16aba515928b009d1a8b76
  • Loading branch information
roywei committed Feb 16, 2021
1 parent 6dd1604 commit e21ac6b
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -473,7 +473,7 @@ public void testRNNTanh() throws IOException, MalformedModelException {
Assertions.assertAlmostEquals(result.size(), 2);
NDArray lossValue =
loss.evaluate(new NDList(labels), new NDList(result.head()));
Assertions.assertAlmostEquals(lossValue.getFloat(), -18);
Assertions.assertAlmostEquals(lossValue.getFloat(), 24.9533);
testEncode(manager, block);
}
}
Expand Down Expand Up @@ -521,7 +521,9 @@ public void testRNNRelu() throws IOException, MalformedModelException {
Assertions.assertAlmostEquals(result.size(), 2);
NDArray lossValue =
loss.evaluate(new NDList(labels), new NDList(result.head()));
Assertions.assertAlmostEquals(lossValue.getFloat(), -908);
// loss should be the same as testRNNTanh because outputs are equal for each
// class
Assertions.assertAlmostEquals(lossValue.getFloat(), 24.9533);
testEncode(manager, block);
}
}
Expand Down Expand Up @@ -571,7 +573,7 @@ public void testLstm() throws IOException, MalformedModelException {
Assertions.assertAlmostEquals(result.size(), 3);
NDArray lossValue =
loss.evaluate(new NDList(labels), new NDList(result.head()));
Assertions.assertAlmostEquals(lossValue.getFloat(), -16.340019);
Assertions.assertAlmostEquals(lossValue.getFloat(), 24.9533);
testEncode(manager, block);
}
}
Expand Down Expand Up @@ -628,7 +630,7 @@ public void testGRU() throws IOException, MalformedModelException {
Assertions.assertAlmostEquals(result.size(), 1);
NDArray lossValue =
loss.evaluate(new NDList(labels), new NDList(result.head()));
Assertions.assertAlmostEquals(lossValue.getFloat(), -8.17537307E-4);
Assertions.assertAlmostEquals(lossValue.getFloat(), 24.9533);
testEncode(manager, block);
}
}
Expand Down

0 comments on commit e21ac6b

Please sign in to comment.