mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-20 23:57:06 +08:00
avoid ImageSharpen node bug on macOS
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
This commit is contained in:
parent
2aed53c4ac
commit
14718354d7
@ -222,12 +222,13 @@ class Sharpen:
|
||||
|
||||
CATEGORY = "image/postprocessing"
|
||||
|
||||
def sharpen(self, image: torch.Tensor, sharpen_radius: int, sigma:float, alpha: float):
|
||||
def sharpen(self, image: torch.Tensor, sharpen_radius: int, sigma: float, alpha: float):
|
||||
if sharpen_radius == 0:
|
||||
return (image,)
|
||||
|
||||
batch_size, height, width, channels = image.shape
|
||||
image = image.to(comfy.model_management.get_torch_device())
|
||||
if not comfy.model_management.mps_mode():
|
||||
image = image.to(comfy.model_management.get_torch_device())
|
||||
|
||||
kernel_size = sharpen_radius * 2 + 1
|
||||
kernel = gaussian_kernel(kernel_size, sigma, device=image.device) * -(alpha*10)
|
||||
@ -242,7 +243,7 @@ class Sharpen:
|
||||
|
||||
result = torch.clamp(sharpened, 0, 1)
|
||||
|
||||
return (result.to(comfy.model_management.intermediate_device()),)
|
||||
return (result,) if comfy.model_management.mps_mode() else (result.to(comfy.model_management.intermediate_device()),)
|
||||
|
||||
class ImageScaleToTotalPixels:
|
||||
upscale_methods = ["nearest-exact", "bilinear", "area", "bicubic", "lanczos"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user