import torch | |
class RandomLatentImage: | |
def __init__(self, device="cpu"): | |
self.device = device | |
def INPUT_TYPES(s): | |
return {"required": { "width": ("INT", {"default": 512, "min": 64, "max": 4096, "step": 64}), | |
"height": ("INT", {"default": 512, "min": 64, "max": 4096, "step": 64}), | |
"batch_size": ("INT", {"default": 1, "min": 1, "max": 64})}} | |
RETURN_TYPES = ("LATENT",) | |
FUNCTION = "generate" | |
CATEGORY = "latent" | |
def generate(self, width, height, batch_size=1): | |
latent = torch.randn(batch_size, 4, height // 8, width // 8) | |
return ({"samples":latent}, ) | |