(self, videos)
| 519 | clean='whitespace') |
| 520 | |
| 521 | def visual(self, videos): |
| 522 | # preprocess |
| 523 | size = (self.model.image_size,) * 2 |
| 524 | videos = torch.cat([ |
| 525 | F.interpolate( |
| 526 | u.transpose(0, 1), |
| 527 | size=size, |
| 528 | mode='bicubic', |
| 529 | align_corners=False) for u in videos |
| 530 | ]) |
| 531 | videos = self.transforms.transforms[-1](videos.mul_(0.5).add_(0.5)) |
| 532 | |
| 533 | # forward |
| 534 | with torch.amp.autocast('cuda', dtype=self.dtype): |
| 535 | out = self.model.visual(videos, use_31_block=True) |
| 536 | return out |