Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit a0d7352

Browse files
louisfengfacebook-github-bot
authored andcommitted
Add numerical equivalence check to GraphOptz.nopRelu test case. (#3581)
Summary: Added a numerical equivalence check to this test case which checks that both the original and optimized graph return the same result for the same input. Fixes T54749244 Pull Request resolved: #3581 Test Plan: => ctest -R GraphOptz Test project /Users/lofe/git/glow/build_Debug Start 8: GraphOptzTest 1/1 Test #8: GraphOptzTest .................... Passed 0.09 sec 100% tests passed, 0 tests failed out of 1 Total Test time (real) = 0.10 sec Differential Revision: D17702016 Pulled By: SplitInfinity fbshipit-source-id: 809aad9ddbb5caa10809cbc83ab0871511add015
1 parent 63be3d6 commit a0d7352

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/unittests/GraphOptzTest.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,9 +3026,14 @@ TEST_F(GraphOptz, nopRelu) {
30263026
auto *relu = F_->createRELU("relu", in);
30273027
F_->createSave("save", relu);
30283028

3029-
::glow::optimize(F_, CompilationMode::Infer);
3029+
optimizedF_ = optimizeFunction(F_);
30303030

3031-
EXPECT_EQ(F_->getNodes().size(), 1);
3031+
EXPECT_EQ(optimizedF_->getNodes().size(), 1);
3032+
3033+
bindings_.allocate(mod_.getPlaceholders());
3034+
bindings_.get(in)->getHandle<int8_t>().randomize(-4, 4, mod_.getPRNG());
3035+
3036+
checkNumericalEquivalence();
30323037
}
30333038

30343039
template <typename ElemTy>

0 commit comments

Comments
 (0)