-
Notifications
You must be signed in to change notification settings - Fork 16
Kanvi/skip assert #265
base: master
Are you sure you want to change the base?
Kanvi/skip assert #265
Conversation
Added code for skipping the assert op if the env variable NGRAPH_TF_SKIP_ASSERT is set i.e basically get rid of the control edge Dump unmarked graphs with assert skipped Added python test for checking the assert is actually skipped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes in:
- python test assert
- prints in SkipAssert
test/python/test_skip_assert.py
Outdated
z: test_input | ||
}) | ||
|
||
self.with_ngraph(run_test) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we want to do this with and without ngraph?
assert (self.with_ngraph(run_test) == self.without_ngraph(run_test)).all()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can write a test that fails with tf and works with nGraph (as we got rid of control edges). But would that be ideal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think as a test, it is a good idea. But in a real life network, its not ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the purpose for such a test?
src/ngraph_rewrite_pass.cc
Outdated
if (std::getenv("NGRAPH_TF_SKIP_ASSERT") != nullptr) { | ||
TF_RETURN_IF_ERROR(SkipAssert(options.graph->get())); | ||
// If requested, dump unmarked graphs without asserts | ||
if (DumpCapturedGraphs()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use a new check DumpSkipAssertGraphs() (We can check for DumpAllGraphs() and NGRAPH_TF_SKIP_ASSERT, May not want another flag) like the other ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another concern is that skip assert is part of VariableCapturePass, it should not be there if we go by the name of the pass (should only be capturing variables). We kept it there as we wanted to test at which stage the edges need to be removed and before TF Rewrite for Execution seems to work for us.
So should we introduce/register a new pass or rename the Variable Capture Pass or the current implementation is fine.
On these lines, encapsulate pass also has a function (rewrite for tracking) that does not really align with encapsulation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shresthamalik good feedback. We need to refactor the code to take care of these. Please create a JIRA ticket and we will address these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do anything in this regards for this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/ngraph_rewrite_pass.cc
Outdated
if (std::getenv("NGRAPH_TF_SKIP_ASSERT") != nullptr) { | ||
TF_RETURN_IF_ERROR(SkipAssert(options.graph->get())); | ||
// If requested, dump unmarked graphs without asserts | ||
if (DumpCapturedGraphs()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shresthamalik good feedback. We need to refactor the code to take care of these. Please create a JIRA ticket and we will address these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we doing the ngraph-will-pass-but-tf-will-fail test?
the python test could be arranged as:
try:
run_tf
assert False #the above line should fail, so we should not hit this assert
catch:
run_ngtf #once run-tf fails, we land up here
LGTM otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the test. LGTM
}) | ||
|
||
assert ( | ||
self.with_ngraph(run_test) == self.without_ngraph(run_test)).all() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test wont run with the env variable in the CI, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to revisit the test.
No description provided.