(self, x, attn_mask=None)
| 109 | self.norm = norm_layer |
| 110 | |
| 111 | def forward(self, x, attn_mask=None): |
| 112 | attns = [] |
| 113 | if self.conv_layers is not None: |
| 114 | for attn_layer, conv_layer in zip(self.attn_layers, self.conv_layers): |
| 115 | x, attn = attn_layer(x, attn_mask=attn_mask) |
| 116 | x = conv_layer(x) |
| 117 | attns.append(attn) |
| 118 | x, attn = self.attn_layers[-1](x) |
| 119 | attns.append(attn) |
| 120 | else: |
| 121 | for attn_layer in self.attn_layers: |
| 122 | x, attn = attn_layer(x, attn_mask=attn_mask) |
| 123 | attns.append(attn) |
| 124 | |
| 125 | if self.norm is not None: |
| 126 | x = self.norm(x) |
| 127 | |
| 128 | return x, attns |
| 129 | |
| 130 | |
| 131 | class DecoderLayer(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected