diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-09-28 23:42:38 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-09-28 23:42:38 +0200 |
commit | 2f611f8c13e4084a50f97b5c94ca82cf71891654 (patch) | |
tree | 53e76b4536fdaca18d765d941252d1cee509e89b | |
parent | 6547760bfaae0a744ea633eb03cea89775e93c72 (diff) |
Remove inplace ops for grad flow
-rw-r--r-- | text_recognizer/networks/transformer/decoder_block.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/text_recognizer/networks/transformer/decoder_block.py b/text_recognizer/networks/transformer/decoder_block.py index e6e7fb8..b80a078 100644 --- a/text_recognizer/networks/transformer/decoder_block.py +++ b/text_recognizer/networks/transformer/decoder_block.py @@ -36,11 +36,11 @@ class DecoderBlock(nn.Module): ) -> Tensor: """Applies decoder block on input signals.""" x = x + self.attn(self.ln_attn(x), input_mask=input_mask) - x += self.cross_attn( + x = x + self.cross_attn( x=self.ln_cross_attn(x), context=context, input_mask=input_mask, context_mask=context_mask, ) - x += self.ff(self.ln_ff(x)) + x = x + self.ff(self.ln_ff(x)) return x |