(self, x)
| 103 | print('Changed progressive stage to: ', new_stage) |
| 104 | |
| 105 | def forward(self, x): |
| 106 | x = self.input_layer(x) |
| 107 | |
| 108 | modulelist = list(self.body._modules.values()) |
| 109 | for i, l in enumerate(modulelist): |
| 110 | x = l(x) |
| 111 | if i == 6: |
| 112 | c1 = x |
| 113 | elif i == 20: |
| 114 | c2 = x |
| 115 | elif i == 23: |
| 116 | c3 = x |
| 117 | |
| 118 | # Infer main W and duplicate it |
| 119 | w0 = self.styles[0](c3) |
| 120 | w = w0.repeat(self.style_count, 1, 1).permute(1, 0, 2) |
| 121 | stage = self.progressive_stage.value |
| 122 | features = c3 |
| 123 | for i in range(1, min(stage + 1, self.style_count)): # Infer additional deltas |
| 124 | if i == self.coarse_ind: |
| 125 | p2 = _upsample_add(c3, self.latlayer1(c2)) # FPN's middle features |
| 126 | features = p2 |
| 127 | elif i == self.middle_ind: |
| 128 | p1 = _upsample_add(p2, self.latlayer2(c1)) # FPN's fine features |
| 129 | features = p1 |
| 130 | delta_i = self.styles[i](features) |
| 131 | w[:, i] += delta_i |
| 132 | return w |
| 133 | |
| 134 | |
| 135 | class E4eEncoder(nn.Module): |
nothing calls this directly
no test coverage detected