We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 454a2f6 commit 5e51169Copy full SHA for 5e51169
training_ptr_gen/model.py
@@ -72,8 +72,10 @@ def __init__(self):
72
73
def forward(self, hidden):
74
h, c = hidden # h, c dim = 2 x b x hidden_dim
75
- hidden_reduced_h = F.relu(self.reduce_h(h.view(-1, config.hidden_dim * 2)))
76
- hidden_reduced_c = F.relu(self.reduce_c(c.view(-1, config.hidden_dim * 2)))
+ h_in = h.transpose(0, 1).contiguous().view(-1, config.hidden_dim * 2)
+ hidden_reduced_h = F.relu(self.reduce_h(h_in))
77
+ c_in = c.transpose(0, 1).contiguous().view(-1, config.hidden_dim * 2)
78
+ hidden_reduced_c = F.relu(self.reduce_c(c_in))
79
80
return (hidden_reduced_h.unsqueeze(0), hidden_reduced_c.unsqueeze(0)) # h, c dim = 1 x b x hidden_dim
81
0 commit comments