summaryrefslogtreecommitdiff
path: root/text_recognizer/networks/transformer
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-09-28 23:42:38 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-09-28 23:42:38 +0200
commit2f611f8c13e4084a50f97b5c94ca82cf71891654 (patch)
tree53e76b4536fdaca18d765d941252d1cee509e89b /text_recognizer/networks/transformer
parent6547760bfaae0a744ea633eb03cea89775e93c72 (diff)
Remove inplace ops for grad flow
Diffstat (limited to 'text_recognizer/networks/transformer')
-rw-r--r--text_recognizer/networks/transformer/decoder_block.py4
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