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

fail to set batch_first == True #1

Open
RiqiangGao opened this issue Jan 31, 2019 · 2 comments
Open

fail to set batch_first == True #1

RiqiangGao opened this issue Jan 31, 2019 · 2 comments

Comments

@RiqiangGao
Copy link

Thanks for sharing your code. When I use this code, I find that when I set the batch_first == True, the net still with batch_first == False version. Any ideas?

Thanks again

@kamo-naoyuki
Copy link
Owner

Thank you for using my modules and reporting issue, but I'm not sure your case.
The behaviour of batch_first is very simple and I think there are no bugs.

def forward(input, weight, hidden, batch_sizes):
if batch_first and batch_sizes is None:
input = input.transpose(0, 1)
nexth, output = func(input, hidden, weight, batch_sizes)
if batch_first and batch_sizes is None:
output = output.transpose(0, 1)

If you are using PackedSequence, this option should be ignored.

@RiqiangGao
Copy link
Author

Thank you for using my modules and reporting issue, but I'm not sure your case.
The behaviour of batch_first is very simple and I think there are no bugs.

pytorch_convolutional_rnn/convolutional_rnn/functional.py

Lines 307 to 314 in 094b3bd

def forward(input, weight, hidden, batch_sizes):
if batch_first and batch_sizes is None:
input = input.transpose(0, 1)

 nexth, output = func(input, hidden, weight, batch_sizes) 

 if batch_first and batch_sizes is None: 
     output = output.transpose(0, 1) 

If you are using PackedSequence, this option should be ignored.

Thanks a lot again. I will take a further look.

BTW, I have motivated by your RNN cell functions before and they help my project. And I plan to learn all your functions about RNN. Thanks for sharing.

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

No branches or pull requests

2 participants