Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyTorch-Tutorial/tutorial-contents/403_RNN_regressor.py contains a weird line of code #49

Open
BlackTentacle opened this issue Oct 26, 2018 · 3 comments

Comments

@BlackTentacle
Copy link

@BlackTentacle BlackTentacle commented Oct 26, 2018

I tried some RNN regression learning based on the code in the "PyTorch-Tutorial/tutorial-contents/403_RNN_regressor.py" file, which did not work for me at all.

According to an accepted answer on stack-overflow (https://stackoverflow.com/questions/52857213/recurrent-network-rnn-wont-learn-a-very-simple-function-plots-shown-in-the-q?noredirect=1#comment92916825_52857213), it turns out that the line

h_state = h_state.data

of the tutorial file does not do what it is supposed to be doing. It does not actually break the connection to the previous iteration as specified in the commment. Rather the line

h_state = None

should do the trick (according to the accepted answer).

@simon19891101
Copy link

@simon19891101 simon19891101 commented Oct 27, 2018

Indeed, I guess the comment is for the case whereby elements in batches are unrelated, like the MNIST example, however the code is correct here for continuous data.

@MorvanZhou
Copy link
Owner

@MorvanZhou MorvanZhou commented Oct 29, 2018

Is the bug related to pytorch's version? The pytorch '0.4.1' runs fine.

@SkatingLiu
Copy link

@SkatingLiu SkatingLiu commented Mar 8, 2019

when I use torchvision.datasets.MNIST, why occurs TypeError: init() missing 1 required positional argument: 'total'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.