MCPcopy Create free account
hub / github.com/QWTforGithub/T2LDM / randn

Method randn

models/diffusion/base.py:105–121  ·  view source on GitHub ↗
(
            self,
            *shape,
            rng: List[torch.Generator] | torch.Generator | None = None,
            **kwargs,
    )

Source from the content-addressed store, hash-verified

103 return self._dummy.device
104
105 def randn(
106 self,
107 *shape,
108 rng: List[torch.Generator] | torch.Generator | None = None,
109 **kwargs,
110 ) -> torch.Tensor:
111 if rng is None:
112 return torch.randn(*shape, **kwargs)
113 elif isinstance(rng, torch.Generator):
114 return torch.randn(*shape, generator=rng, **kwargs)
115 elif isinstance(rng, list):
116 assert len(rng) == shape[0]
117 return torch.stack(
118 [torch.randn(*shape[1:], generator=r, **kwargs) for r in rng]
119 )
120 else:
121 raise ValueError(f"invalid rng: {rng}")
122
123 def randn_like(
124 self,

Callers 13

randn_likeMethod · 0.95
_apply_noiseMethod · 0.80
_add_noiseMethod · 0.80
__init__Method · 0.80
drop_block_2dFunction · 0.80
drop_block_fast_2dFunction · 0.80
__init__Method · 0.80
__init__Method · 0.80
T2LDM.pyFile · 0.80
sampleMethod · 0.80
sampleMethod · 0.80
__init__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected