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

Function enable_stratified

k_diffusion/utils.py:284–294  ·  view source on GitHub ↗

A context manager that enables stratified sampling.

(group=0, groups=1, disable=False)

Source from the content-addressed store, hash-verified

282
283@contextmanager
284def enable_stratified(group=0, groups=1, disable=False):
285 """A context manager that enables stratified sampling."""
286 try:
287 stratified_settings.disable = disable
288 stratified_settings.group = group
289 stratified_settings.groups = groups
290 yield
291 finally:
292 del stratified_settings.disable
293 del stratified_settings.group
294 del stratified_settings.groups
295
296
297@contextmanager

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected