r""" Perform upsampling while ensuring the output tensor has the same data type as the input. Args: x (torch.Tensor): Input tensor to be upsampled. Returns: torch.Tensor: Upsampled tensor with the same data type as the input.
| 203 | |
| 204 | |
| 205 | class WanUpsample(nn.Upsample): |
| 206 | r""" |
| 207 | Perform upsampling while ensuring the output tensor has the same data type as the input. |
| 208 | |
| 209 | Args: |
| 210 | x (torch.Tensor): Input tensor to be upsampled. |
| 211 | |
| 212 | Returns: |
| 213 | torch.Tensor: Upsampled tensor with the same data type as the input. |
| 214 | """ |
| 215 | |
| 216 | def forward(self, x): |
| 217 | return super().forward(x.float()).type_as(x) |
| 218 | |
| 219 | |
| 220 | class WanResample(nn.Module): |