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

what's the usage of ' is_train' in forward? #1822

Closed
xzqjack opened this issue Apr 11, 2016 · 3 comments
Closed

what's the usage of ' is_train' in forward? #1822

xzqjack opened this issue Apr 11, 2016 · 3 comments

Comments

@xzqjack
Copy link

xzqjack commented Apr 11, 2016

As @piiswrong mentioned in another issue, if i want to call backward afterwards, i should set is_train=True. But I noticed that backward op works well with is_train=False in many example codes, such as "neural-style".
On the other hand, when i just need the output. Forward op didn't work with is_train=False and worked well with is_train =True.
I'm confused with the usage of is_train parameter.

I want to ask how is_train=True affect the output of forward Op?
Is it ok to set all is_train to True?

Anyone explaining this will be appreciated.
Thanks in advance.

@xzqjack
Copy link
Author

xzqjack commented Apr 12, 2016

A guess about the design principle of is_train is that, if is_train is set to True, the intermediate results of intermediate layers will not be saved and if is_train is set to False, the intermediate results will be saved. This design principle could save memory, because forward computation doesn't need to save the intermediate results?
Is the guess right?

@tqchen
Copy link
Member

tqchen commented Apr 12, 2016

is_train was not related to memory saving, but will only affect some runtime behavior of operators. Currently it is mainly for things like dropout and batchnorm

@xzqjack
Copy link
Author

xzqjack commented Apr 14, 2016

Thank you very much. I guess i got that finally.

@xzqjack xzqjack closed this as completed Apr 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants