MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / stratified_with_settings

Function stratified_with_settings

k_diffusion/utils.py:314–321  ·  view source on GitHub ↗

Draws stratified samples from a uniform distribution, using settings from a context manager.

(shape, dtype=None, device=None)

Source from the content-addressed store, hash-verified

312
313
314def stratified_with_settings(shape, dtype=None, device=None):
315 """Draws stratified samples from a uniform distribution, using settings from a context
316 manager."""
317 if not hasattr(stratified_settings, 'disable') or stratified_settings.disable:
318 return torch.rand(shape, dtype=dtype, device=device)
319 return stratified_uniform(
320 shape, stratified_settings.group, stratified_settings.groups, dtype=dtype, device=device
321 )
322
323
324def rand_log_normal(shape, loc=0., scale=1., device='cpu', dtype=torch.float32):

Callers 5

rand_log_normalFunction · 0.85
rand_log_logisticFunction · 0.85
rand_log_uniformFunction · 0.85
rand_v_diffusionFunction · 0.85
rand_cosine_interpolatedFunction · 0.85

Calls 1

stratified_uniformFunction · 0.85

Tested by

no test coverage detected