Fix VAE pixel normalization in-place bug
This commit is contained in:
parent
9bec53ac36
commit
390135fca6
1 changed files with 2 additions and 1 deletions
|
|
@ -256,7 +256,8 @@ class MiniMaxH3VideoVAEEncoder(nn.Module):
|
|||
"""``[B,3,H,W]`` or ``[B,3,T,H,W]`` pixels in ``[-1, 1]`` -> normalized latents ``[B,24,T_lat,H//16,W//16]``."""
|
||||
if x.ndim == 4:
|
||||
x = x.unsqueeze(2)
|
||||
x = x.add(1.0).mul_(0.5).sub_(self.pixel_mean.to(x)).div_(self.pixel_std.to(x))
|
||||
x = (x + 1.0) * 0.5
|
||||
x = (x - self.pixel_mean.to(x)) / self.pixel_std.to(x)
|
||||
if x.shape[2] == 1:
|
||||
moments = self._adaptive_encode(x)[:, :, -1:, :, :]
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue