Replace manual x * sigmoid(x) with torch silu in VAE nonlinearity (#9057)

This commit is contained in:
chaObserv
2025-07-31 07:25:56 +08:00
committed by GitHub
parent da9dab7edd
commit 61b08d4ba6
2 changed files with 3 additions and 2 deletions

View File

@@ -58,7 +58,8 @@ def is_odd(n: int) -> bool:
def nonlinearity(x):
return x * torch.sigmoid(x)
# x * sigmoid(x)
return torch.nn.functional.silu(x)
def Normalize(in_channels, num_groups=32):

View File

@@ -36,7 +36,7 @@ def get_timestep_embedding(timesteps, embedding_dim):
def nonlinearity(x):
# swish
return x*torch.sigmoid(x)
return torch.nn.functional.silu(x)
def Normalize(in_channels, num_groups=32):