Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Make EmptyImage node follow intermediate device/dtype. (#13079)

comfyanonymous45d5c83a3005
diff --git a/nodes.py b/nodes.py
index e93fa9767..2c4650a20 100644
--- a/nodes.py
+++ b/nodes.py
@@ -1966,9 +1966,11 @@ class EmptyImage:
CATEGORY = "image"
def generate(self, width, height, batch_size=1, color=0):
- r = torch.full([batch_size, height, width, 1], ((color >> 16) & 0xFF) / 0xFF)
- g = torch.full([batch_size, height, width, 1], ((color >> 8) & 0xFF) / 0xFF)
- b = torch.full([batch_size, height, width, 1], ((color) & 0xFF) / 0xFF)
+ dtype = comfy.model_management.intermediate_dtype()
+ device = comfy.model_management.intermediate_device()
+ r = torch.full([batch_size, height, width, 1], ((color >> 16) & 0xFF) / 0xFF, device=device, dtype=dtype)
+ g = torch.full([batch_size, height, width, 1], ((color >> 8) & 0xFF) / 0xFF, device=device, dtype=dtype)
+ b = torch.full([batch_size, height, width, 1], ((color) & 0xFF) / 0xFF, device=device, dtype=dtype)
return (torch.cat((r, g, b), dim=-1), )
class ImagePadForOutpaint: