atulkum / atulkum/pointer_summarizer

strange view() operation in ReduceState module

Open
#11 14 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
909
Forks
235
PR merge metrics
No merged PRs in 30d

Description

We wanna reduce the forward and backward state, so we need to concatenate the forward state and backward state, then go through a nn.Linear module to let 2 * hidden_dim become hidden_dim.

In your code, h is 2 x B x hidden_dim, and you use view() operation directly on h and c. The results should be concatenating first example forward state and second example forward state, not concatenating first example forward state and first example backward state.

In my opinion, we should use h.transpose(0, 1).contiguous().view(-1, config.hidden_dim*2).

https://github.com/atulkum/pointer_summarizer/blob/454a2f6f10865531f724cbe5064a927d66dfa1b7/training_ptr_gen/model.py#L75

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.