| 209 | |
| 210 | |
| 211 | class DecoderLayer(nn.Module): |
| 212 | |
| 213 | def __init__(self, ca_block_cfg=None, ffn_cfg=None): |
| 214 | super().__init__() |
| 215 | self.ca_block = build_attention(ca_block_cfg) |
| 216 | self.ffn = SFFN(**ffn_cfg) |
| 217 | |
| 218 | def forward(self, **kwargs): |
| 219 | if self.ca_block is not None: |
| 220 | x = self.ca_block(**kwargs) |
| 221 | kwargs.update({'x': x}) |
| 222 | if self.ffn is not None: |
| 223 | x = self.ffn(**kwargs) |
| 224 | return x |
| 225 | |
| 226 | |
| 227 | @SUBMODULES.register_module() |
no outgoing calls
no test coverage detected