mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-03-15 14:09:36 +00:00
Round up to nearest power of 2 in SAG node to fix some resolution issues.
This commit is contained in:
parent
6a7bc35db8
commit
2c80d9acb9
@ -58,7 +58,7 @@ def create_blur_map(x0, attn, sigma=3.0, threshold=1.0):
|
|||||||
attn = attn.reshape(b, -1, hw1, hw2)
|
attn = attn.reshape(b, -1, hw1, hw2)
|
||||||
# Global Average Pool
|
# Global Average Pool
|
||||||
mask = attn.mean(1, keepdim=False).sum(1, keepdim=False) > threshold
|
mask = attn.mean(1, keepdim=False).sum(1, keepdim=False) > threshold
|
||||||
ratio = math.ceil(math.sqrt(lh * lw / hw1))
|
ratio = 2**(math.ceil(math.sqrt(lh * lw / hw1)) - 1).bit_length()
|
||||||
mid_shape = [math.ceil(lh / ratio), math.ceil(lw / ratio)]
|
mid_shape = [math.ceil(lh / ratio), math.ceil(lw / ratio)]
|
||||||
|
|
||||||
# Reshape
|
# Reshape
|
||||||
|
Loading…
Reference in New Issue
Block a user