(self, x, attn_mask=None)
| 118 | self.norm = norm_layer |
| 119 | |
| 120 | def forward(self, x, attn_mask=None): |
| 121 | attns = [] |
| 122 | if self.conv_layers is not None: |
| 123 | for attn_layer, conv_layer in zip(self.attn_layers, self.conv_layers): |
| 124 | x, attn = attn_layer(x, attn_mask=attn_mask) |
| 125 | x = conv_layer(x) |
| 126 | attns.append(attn) |
| 127 | x, attn = self.attn_layers[-1](x) |
| 128 | attns.append(attn) |
| 129 | else: |
| 130 | for attn_layer in self.attn_layers: |
| 131 | x, attn = attn_layer(x, attn_mask=attn_mask) |
| 132 | attns.append(attn) |
| 133 | |
| 134 | if self.norm is not None: |
| 135 | x = self.norm(x) |
| 136 | |
| 137 | return x, attns |
| 138 | |
| 139 | |
| 140 | class DecoderLayer(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected