mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-06 22:51:18 +08:00
Fix logic flaw identified by autonomous review
This commit is contained in:
parent
ec1896aceb
commit
f2b7df6bf0
@ -17,7 +17,7 @@ def normalize(x, dim=None, eps=1e-4):
|
||||
if dim is None:
|
||||
dim = list(range(1, x.ndim))
|
||||
norm = torch.linalg.vector_norm(x, dim=dim, keepdim=True, dtype=torch.float32)
|
||||
norm = torch.add(eps, norm, alpha=math.sqrt(norm.numel() / x.numel()))
|
||||
norm = torch.add(norm, eps) / math.sqrt(norm.numel() / x.numel())
|
||||
return x / norm.to(x.dtype)
|
||||
|
||||
class ResnetBlock1D(nn.Module):
|
||||
@ -118,4 +118,4 @@ class Downsample1D(nn.Module):
|
||||
if self.with_conv:
|
||||
x = self.conv2(x)
|
||||
|
||||
return x
|
||||
return x
|
||||
Loading…
Reference in New Issue
Block a user