mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-10 01:02:56 +08:00
Fix bug when mask not on same device
This commit is contained in:
parent
d3c18c1636
commit
b42f8a7ba7
@ -203,7 +203,7 @@ class JoinImageWithAlpha(io.ComfyNode):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def execute(cls, image: torch.Tensor, alpha: torch.Tensor) -> io.NodeOutput:
|
def execute(cls, image: torch.Tensor, alpha: torch.Tensor) -> io.NodeOutput:
|
||||||
batch_size = max(len(image), len(alpha))
|
batch_size = max(len(image), len(alpha))
|
||||||
alpha = 1.0 - resize_mask(alpha, image.shape[1:])
|
alpha = 1.0 - resize_mask(alpha.to(image.device), image.shape[1:])
|
||||||
alpha = comfy.utils.repeat_to_batch_size(alpha, batch_size)
|
alpha = comfy.utils.repeat_to_batch_size(alpha, batch_size)
|
||||||
image = comfy.utils.repeat_to_batch_size(image, batch_size)
|
image = comfy.utils.repeat_to_batch_size(image, batch_size)
|
||||||
return io.NodeOutput(torch.cat((image[..., :3], alpha.unsqueeze(-1)), dim=-1))
|
return io.NodeOutput(torch.cat((image[..., :3], alpha.unsqueeze(-1)), dim=-1))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user