change the bitwise for masking and small fixes

This commit is contained in:
Eren Golge
2019-08-19 16:24:28 +02:00
parent c637aa04a2
commit 72ad58d893
3 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -234,7 +234,7 @@ class Attention(nn.Module):
query, processed_inputs)
# apply masking
if mask is not None:
attention.data.masked_fill_(torch.bitwise_not(mask), self._mask_value)
attention.data.masked_fill_(~mask, self._mask_value)
# apply windowing - only in eval mode
if not self.training and self.windowing:
attention = self.apply_windowing(attention, inputs)
+1 -1
View File
@@ -315,7 +315,7 @@ class Decoder(nn.Module):
# learn init values instead of zero init.
self.stopnet = StopNet(256 + memory_dim * self.r_init)
def _set_r(self, new_r):
def set_r(self, new_r):
self.r = new_r
def _reshape_memory(self, memory):