Fix bug: clamp the controller output before making it interface vector

This commit is contained in:
ixaxaar 2017-12-20 14:24:42 +05:30
parent 1abd4c4ba4
commit 08bd220852

View File

@ -178,14 +178,15 @@ class DNC(nn.Module):
input, chx = self.rnns[layer](input.unsqueeze(1), chx) input, chx = self.rnns[layer](input.unsqueeze(1), chx)
input = input.squeeze(1) input = input.squeeze(1)
# the interface vector
ξ = input
# clip the controller output # clip the controller output
if self.clip != 0: if self.clip != 0:
output = T.clamp(input, -self.clip, self.clip) output = T.clamp(input, -self.clip, self.clip)
else: else:
output = input output = input
# the interface vector
ξ = output
# pass through memory # pass through memory
if pass_through_memory: if pass_through_memory:
if self.share_memory: if self.share_memory: