kwotsin
kwotsin

Reputation: 2923

TensorFlow: What is the purpose of checking for stops in a Supervisor Managed Session?

I've just read the documentation here again, and it says the supervisor needs to explicitly check for the stop condition in the main loop, but it doesn't explain why it has to do so. What's the reason behind it?

So far for most of my code I've not included this condition and things still work fine. Is there a case I should be worried about here?

Also, if the condition is a standard code like:

if sv.should_stop():
    sv.request_stop()

that has to be included every time a session was run, why couldn't it be included in a managed session by default? Meaning to say, is there a special use for writing this code explicitly in the for/while loop for training?

Upvotes: 0

Views: 102

Answers (1)

Alexandre Passos
Alexandre Passos

Reputation: 5206

This is in case one of your queues becomes empty, or something else errors out and requires you to stop. If your queues are never empty and there are never any errors then you don't need to check.

Upvotes: 1

Related Questions