Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Kanvi/skip assert #265

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Kanvi/skip assert #265

wants to merge 16 commits into from

Conversation

kanvi-nervana
Copy link
Contributor

No description provided.

kanvi.khanna added 4 commits October 16, 2018 16:52
 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
Copy link
Contributor

@sayantan-nervana sayantan-nervana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes in:

  1. python test assert
  2. prints in SkipAssert

z: test_input
})

self.with_ngraph(run_test)
Copy link
Contributor

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()

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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_skip_assert.cc Outdated Show resolved Hide resolved
src/ngraph_skip_assert.cc Outdated Show resolved Hide resolved
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()) {
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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 Show resolved Hide resolved
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()) {
Copy link
Contributor

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.

src/ngraph_skip_assert.cc Outdated Show resolved Hide resolved
test/python/test_skip_assert.py Outdated Show resolved Hide resolved
Copy link
Contributor

@avijit-nervana avijit-nervana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Copy link
Contributor

@sayantan-nervana sayantan-nervana left a 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

Copy link
Contributor

@shresthamalik shresthamalik left a 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()
Copy link
Contributor

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?

@avijit-nervana avijit-nervana added the Fully Reviewed All reviewers have approved label Oct 19, 2018
@sayantan-nervana sayantan-nervana removed Fully Reviewed All reviewers have approved labels Oct 19, 2018
Copy link
Contributor

@shresthamalik shresthamalik left a 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants