8000 Ensure Contiguous Hidden State Tensors in Encoders by dangitstam · Pull Request #1493 · allenai/allennlp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Ensure Contiguous Hidden State Tensors in Encoders #1493

Merged
merged 6 commits into from
Jul 17, 2018

Conversation

dangitstam
Copy link
Contributor

index_select() doesn't ensure a contiguous tensor, which can cause a runtime exception since PyTorch RNNs require them to be .

@DeNeutoy
Copy link
Contributor

Could you add a small test to demonstrate that this works? It can go either here:
https://github.com/allenai/allennlp/blob/master/allennlp/tests/modules/seq2vec_encoders/pytorch_seq2vec_wrapper_test.py
or here:
https://github.com/allenai/allennlp/blob/master/allennlp/tests/modules/encoder_base_test.py
whichever is easiest for you to add to.

Simply demonstrating that the wrapper can run forward when the input state is non-contiguous would be enough, nothing complicated!

@dangitstam
Copy link
Contributor Author

Test added to encoder_base_test.py here: 4399ac4

Copy link
Contributor
@DeNeutoy DeNeutoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the test, LGTM 👍

@DeNeutoy DeNeutoy merged commit 8a20820 into allenai:master Jul 17, 2018
gabrielStanovsky pushed a commit to gabrielStanovsky/allennlp that referenced this pull request Sep 7, 2018
*  doesn't ensure a contiguous tensor, causes runtime exception

* adding test for robustness against non-contiguous input states
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0