mirror of
https://github.com/Wan-Video/Wan2.1.git
synced 2025-11-05 06:29:14 +00:00
13 lines
361 B
Python
13 lines
361 B
Python
from typing import Optional
|
|
|
|
import torch
|
|
|
|
|
|
def log_normal_sample(x: torch.Tensor,
|
|
generator: Optional[torch.Generator] = None,
|
|
m: float = 0.0,
|
|
s: float = 1.0) -> torch.Tensor:
|
|
bs = x.shape[0]
|
|
s = torch.randn(bs, device=x.device, generator=generator) * s + m
|
|
return torch.sigmoid(s)
|