utils
C
module-attribute
C = TypeVar('C', bound=Callable)
Resolution
module-attribute
Resolution = Literal[
4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192
]
T
module-attribute
T = TypeVar('T')
default_channels
module-attribute
default_channels: Dict[Resolution, int] = {
4: 512,
8: 512,
16: 512,
32: 512,
64: 512,
128: 256,
256: 128,
512: 64,
1024: 32,
}
accumulate
accumulate(
model1: nn.Module,
model2: nn.Module,
decay: float = 0.5 ** (32 / (10 * 1000)),
) -> None
Accumulate parameters of model2 onto model1 using EMA
Source code in stylegan2_torch/utils.py
43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
make_kernel
make_kernel(k: List[int], factor: int = 1) -> Tensor
Creates 2D kernel from 1D kernel, compensating for zero-padded upsampling factor
Source code in stylegan2_torch/utils.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
make_noise
make_noise(
batch: int, latent_dim: int, n_noise: int, device: str
)
Makes a random, normally distributed latent vector.
Source code in stylegan2_torch/utils.py
58 59 60 61 62 63 |
|
mixing_noise
mixing_noise(
batch: int, latent_dim: int, prob: float, device: str
)
Makes a random, normally distributed latent vector. Returns a pair if mixing regularization.
Source code in stylegan2_torch/utils.py
66 67 68 69 70 |
|
proxy
proxy(f: C) -> C
Proxy function signature map for Module.__call__
type hint.
Source code in stylegan2_torch/utils.py
73 74 75 76 77 |
|