backend add outpainting

This commit is contained in:
Qing
2023-08-30 13:28:31 +08:00
parent 0b3a9a68a2
commit c7c309cb89
5 changed files with 354 additions and 13 deletions

View File

@@ -27,7 +27,7 @@ def make_beta_schedule(
if schedule == "linear":
betas = (
torch.linspace(
linear_start ** 0.5, linear_end ** 0.5, n_timestep, dtype=torch.float64
linear_start**0.5, linear_end**0.5, n_timestep, dtype=torch.float64
)
** 2
)
@@ -772,7 +772,7 @@ def conv2d_resample(
f=f,
up=up,
padding=[px0, px1, py0, py1],
gain=up ** 2,
gain=up**2,
flip_filter=flip_filter,
)
return x
@@ -814,7 +814,7 @@ def conv2d_resample(
x=x,
f=f,
padding=[px0 + pxt, px1 + pxt, py0 + pyt, py1 + pyt],
gain=up ** 2,
gain=up**2,
flip_filter=flip_filter,
)
if down > 1:
@@ -834,7 +834,7 @@ def conv2d_resample(
f=(f if up > 1 else None),
up=up,
padding=[px0, px1, py0, py1],
gain=up ** 2,
gain=up**2,
flip_filter=flip_filter,
)
x = _conv2d_wrapper(x=x, w=w, groups=groups, flip_weight=flip_weight)
@@ -870,7 +870,7 @@ class Conv2dLayer(torch.nn.Module):
self.register_buffer("resample_filter", setup_filter(resample_filter))
self.conv_clamp = conv_clamp
self.padding = kernel_size // 2
self.weight_gain = 1 / np.sqrt(in_channels * (kernel_size ** 2))
self.weight_gain = 1 / np.sqrt(in_channels * (kernel_size**2))
self.act_gain = activation_funcs[activation].def_gain
memory_format = (