Skip to content

Commit 45d5c83

Browse files
Make EmptyImage node follow intermediate device/dtype. (Comfy-Org#13079)
1 parent c646d21 commit 45d5c83

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

nodes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,9 +1966,11 @@ def INPUT_TYPES(s):
19661966
CATEGORY = "image"
19671967

19681968
def generate(self, width, height, batch_size=1, color=0):
1969-
r = torch.full([batch_size, height, width, 1], ((color >> 16) & 0xFF) / 0xFF)
1970-
g = torch.full([batch_size, height, width, 1], ((color >> 8) & 0xFF) / 0xFF)
1971-
b = torch.full([batch_size, height, width, 1], ((color) & 0xFF) / 0xFF)
1969+
dtype = comfy.model_management.intermediate_dtype()
1970+
device = comfy.model_management.intermediate_device()
1971+
r = torch.full([batch_size, height, width, 1], ((color >> 16) & 0xFF) / 0xFF, device=device, dtype=dtype)
1972+
g = torch.full([batch_size, height, width, 1], ((color >> 8) & 0xFF) / 0xFF, device=device, dtype=dtype)
1973+
b = torch.full([batch_size, height, width, 1], ((color) & 0xFF) / 0xFF, device=device, dtype=dtype)
19721974
return (torch.cat((r, g, b), dim=-1), )
19731975

19741976
class ImagePadForOutpaint:

0 commit comments

Comments
 (0)