overwrite the original forward_decoder, now input latent are fused
(self, x)
| 178 | return x, mask1, ids_restore1, x1len |
| 179 | |
| 180 | def forward_decoder(self, x): |
| 181 | """ |
| 182 | overwrite the original forward_decoder, now input latent are fused |
| 183 | """ |
| 184 | # add pos embed |
| 185 | x = x + self.decoder_pos_embed[:, 1:, :] |
| 186 | |
| 187 | # apply Transformer blocks |
| 188 | for blk in self.decoder_blocks: |
| 189 | x = blk(x) |
| 190 | x = self.decoder_norm(x) |
| 191 | |
| 192 | # # predictor projection |
| 193 | # x = self.decoder_pred(x) |
| 194 | |
| 195 | # # remove cls token |
| 196 | # x = x[:, 1:, :] |
| 197 | |
| 198 | # # VERSION immediate input --- |
| 199 | # x = x + self.decoder_pos_embed |
| 200 | # x = self.decoder_pred(x) |
| 201 | # x = x[:, 1:, :] |
| 202 | # # --------------------------- |
| 203 | |
| 204 | # VERSION conv ----- |
| 205 | x = x[:, 1:, :] |
| 206 | x = x.reshape(x.shape[0], self.patch_h, self.patch_w, x.shape[-1]) # (B, h, w, chns) |
| 207 | x = x.permute(0, 3, 1, 2).contiguous() # (B, chns, h, w) |
| 208 | # print("before pred size", x.size()) |
| 209 | x = self.decoder_pred(x) |
| 210 | # patchify back to accomodate |
| 211 | x = self.patchify(x) |
| 212 | # print("pred size", x.size()) |
| 213 | # -------------------- |
| 214 | return x |
| 215 | |
| 216 | def forward_loss(self, teacher, pred, mask): |
| 217 | """ |