mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-11 10:25:16 +00:00
Fix regression in VAE code on old pytorch versions.
This commit is contained in:
parent
79badea452
commit
4c5c4ddeda
@ -91,7 +91,7 @@ class Upsample(nn.Module):
|
|||||||
|
|
||||||
def forward(self, x):
|
def forward(self, x):
|
||||||
scale_factor = self.scale_factor
|
scale_factor = self.scale_factor
|
||||||
if not isinstance(scale_factor, tuple):
|
if isinstance(scale_factor, (int, float)):
|
||||||
scale_factor = (scale_factor,) * (x.ndim - 2)
|
scale_factor = (scale_factor,) * (x.ndim - 2)
|
||||||
|
|
||||||
if x.ndim == 5 and scale_factor[0] > 1.0:
|
if x.ndim == 5 and scale_factor[0] > 1.0:
|
||||||
@ -109,7 +109,7 @@ class Upsample(nn.Module):
|
|||||||
else:
|
else:
|
||||||
x = a
|
x = a
|
||||||
else:
|
else:
|
||||||
x = interpolate_up(x, self.scale_factor)
|
x = interpolate_up(x, scale_factor)
|
||||||
if self.with_conv:
|
if self.with_conv:
|
||||||
x = self.conv(x)
|
x = self.conv(x)
|
||||||
return x
|
return x
|
||||||
|
Loading…
Reference in New Issue
Block a user