Common#

gaussian

Samples from gaussian with specified shape, dtype, device using torch.randn

gaussian_like

Samples from gaussian like the tensor x using torch.randn_like

uniform_int

Samples ints from uniform distribution using torch.randint

norm

Normalize input to \([-1, 1]\) linearly

denorm

Denormalize input normalized to \([-1, 1]\) linearly back to \([0, 1]\)

make_history

Visualize diffusion process given an array of histories

set_default

helper for setting default values inside __init__ for LightningCLI

dmme.common.gaussian(shape, dtype=None, device=None)[source]#

Samples from gaussian with specified shape, dtype, device using torch.randn

dmme.common.gaussian_like(x)[source]#

Samples from gaussian like the tensor x using torch.randn_like

dmme.common.uniform_int(min, max, count=1, device=None)[source]#

Samples ints from uniform distribution using torch.randint

dmme.common.norm(x)[source]#

Normalize input to \([-1, 1]\) linearly

dmme.common.denorm(x)[source]#

Denormalize input normalized to \([-1, 1]\) linearly back to \([0, 1]\)

dmme.common.make_history(history)[source]#

Visualize diffusion process given an array of histories

Parameters:

history (List[torch.Tensor]) – list of diffusion history with each item as a tensor of shape \((N, C, H, W)\)

dmme.common.set_default(arg, default_value)[source]#

helper for setting default values inside __init__ for LightningCLI