MCPcopy
hub / github.com/black-forest-labs/flux / get_noise

Function get_noise

src/flux/sampling.py:17–33  ·  view source on GitHub ↗
(
    num_samples: int,
    height: int,
    width: int,
    device: torch.device,
    dtype: torch.dtype,
    seed: int,
)

Source from the content-addressed store, hash-verified

15
16
17def get_noise(
18 num_samples: int,
19 height: int,
20 width: int,
21 device: torch.device,
22 dtype: torch.dtype,
23 seed: int,
24):
25 return torch.randn(
26 num_samples,
27 16,
28 # allow for packing
29 2 * math.ceil(height / 16),
30 2 * math.ceil(width / 16),
31 dtype=dtype,
32 generator=torch.Generator(device="cpu").manual_seed(seed),
33 ).to(device)
34
35
36def prepare(t5: HFEmbedder, clip: HFEmbedder, img: Tensor, prompt: str | list[str]) -> dict[str, Tensor]:

Callers 8

mainFunction · 0.90
generate_imageMethod · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
prepare_kontextFunction · 0.85

Calls 1

toMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…