Skip to content

Commit ff32018

Browse files
Adding explicit squeeze dimension
1 parent 4c65331 commit ff32018

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

05-cnn-pytorch/cnn-activation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def forward(self, words, return_activations=False):
2929
# Do max pooling
3030
h = h.max(dim=2)[0] # 1 x num_filters
3131
h = self.relu(h)
32-
features = h.squeeze()
32+
features = h.squeeze(0)
3333
out = self.projection_layer(h) # size(out) = 1 x ntags
3434
if return_activations:
3535
return out, activations.data.cpu().numpy(), features.data.cpu().numpy()

0 commit comments

Comments
 (0)