(self, wa, feats)
| 526 | return img, flow |
| 527 | |
| 528 | def synthesis(self, wa, feats): |
| 529 | bs = wa.shape[0] |
| 530 | |
| 531 | if alpha is not None: |
| 532 | if len(alpha) > 1: |
| 533 | directions_target = self.direction(alpha[0]) # target |
| 534 | directions_source = self.direction(alpha[1]) # source |
| 535 | directions_start = self.direction(alpha[2]) # start |
| 536 | latent = wa + (directions_target - directions_start) + directions_source |
| 537 | else: |
| 538 | directions = self.direction(alpha[0]) |
| 539 | latent = wa + directions # wa + directions |
| 540 | else: |
| 541 | latent = wa |
| 542 | |
| 543 | inject_index = self.n_latent |
| 544 | latent = latent.unsqueeze(1).repeat(1, inject_index, 1) |
| 545 | |
| 546 | out = self.input(latent) |
| 547 | out = self.conv1(out, latent[:, 0]) |
| 548 | |
| 549 | i = 1 |
| 550 | for conv1, conv2, to_rgb, to_flow, feat in zip(self.convs[::2], self.convs[1::2], self.to_rgbs, |
| 551 | self.to_flows, feats): |
| 552 | out = conv1(out, latent[:, i]) |
| 553 | out = conv2(out, latent[:, i + 1]) |
| 554 | if out.size(2) == 8: |
| 555 | out_warp, out, skip_flow, _ = to_flow(out, latent[:, i + 2], feat) |
| 556 | skip = to_rgb(out_warp) |
| 557 | elif out.size(2) == 64: |
| 558 | out_warp, out, skip_flow, flow = to_flow(out, latent[:, i + 2], feat, skip_flow) |
| 559 | skip = to_rgb(out_warp, skip) |
| 560 | else: |
| 561 | out_warp, out, skip_flow, _ = to_flow(out, latent[:, i + 2], feat, skip_flow) |
| 562 | skip = to_rgb(out_warp, skip) |
| 563 | i += 2 |
| 564 | |
| 565 | img = skip |
| 566 | |
| 567 | return img, flow |
nothing calls this directly
no outgoing calls
no test coverage detected