diff options
Diffstat (limited to 'text_recognizer/networks/perceiver')
-rw-r--r-- | text_recognizer/networks/perceiver/perceiver.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/text_recognizer/networks/perceiver/perceiver.py b/text_recognizer/networks/perceiver/perceiver.py index d4bca0b..5b4ab26 100644 --- a/text_recognizer/networks/perceiver/perceiver.py +++ b/text_recognizer/networks/perceiver/perceiver.py @@ -69,15 +69,13 @@ class PerceiverIO(nn.Module): self.decoder_ff = PreNorm(queries_dim, FeedForward(queries_dim)) self.to_logits = nn.Linear(queries_dim, logits_dim) - def forward( - self, data: Tensor, queries: Tensor, mask: Optional[Tensor] = None - ) -> Tensor: + def forward(self, data: Tensor, queries: Tensor) -> Tensor: b = data.shape[0] x = repeat(self.latents, "n d -> b n d", b=b) cross_attn, cross_ff = self.cross_attn_block - x = cross_attn(x, context=data, mask=mask) + x + x = cross_attn(x, context=data) + x x = cross_ff(x) + x for attn, ff in self.layers: |