mokemokechicken / keras_npi

NPI(Neural Programmer-Interpreters) implementation with Keras
MIT License
244 stars 53 forks source link

Why does the AdditionNPIModel's enter_function() and exit_function() are pass? #3

Closed YjyJeff closed 7 years ago

YjyJeff commented 7 years ago

I noticed that in AdditionNPIModel doesn't implement enter_function and exit_function these two methods. Because AdditionNPIModel is derived from NPIStep class, therefore these two methods are pass. According to the paper, every time we enter a function, we should reset the LSTM hidden state and when we return from the function, we should restore the original LSTM state.

Actually, this addition model works perfect even if doesn't implement these two methods. Would it be better(May be less training set or something else) if these two methods are implemented? I noticed that these methods doesn't effect training, so it doesn't have any effect on the model? Why should paper contain these two methods? I know it want to emulate context switch. Does the neural program need context switch to predict next program?

Thanks in advance !

mokemokechicken commented 7 years ago

Hi, @YjyJeff

I don't remember why I didn't implement enter_function and exit_function... (--; As you pointed out, it is better to implement them.

YjyJeff commented 7 years ago

Hi, @mokemokechicken OK, I will have a try. Thanks for your code and I learnt a lot from it !

PlanetMoon commented 6 years ago

Hi, @YjyJeff Maybe you have implement enter_function and exit_function. Can you tell me how you implement them?