Skip to content

Commit

Permalink
Fix bug: clamp the controller output before making it interface vector
Browse files Browse the repository at this point in the history
  • Loading branch information
ixaxaar committed Dec 20, 2017
1 parent 1abd4c4 commit 08bd220
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dnc/dnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,15 @@ def _layer_forward(self, input, layer, hx=(None, None), pass_through_memory=True
input, chx = self.rnns[layer](input.unsqueeze(1), chx)
input = input.squeeze(1)

# the interface vector
ξ = input
# clip the controller output
if self.clip != 0:
output = T.clamp(input, -self.clip, self.clip)
else:
output = input

# the interface vector
ξ = output

# pass through memory
if pass_through_memory:
if self.share_memory:
Expand Down

0 comments on commit 08bd220

Please sign in to comment.