Draws samples from a split lognormal distribution.
(shape, loc, scale_1, scale_2, device='cpu', dtype=torch.float32)
| 377 | |
| 378 | |
| 379 | def rand_split_log_normal(shape, loc, scale_1, scale_2, device='cpu', dtype=torch.float32): |
| 380 | """Draws samples from a split lognormal distribution.""" |
| 381 | n = torch.randn(shape, device=device, dtype=dtype).abs() |
| 382 | u = torch.rand(shape, device=device, dtype=dtype) |
| 383 | n_left = n * -scale_1 + loc |
| 384 | n_right = n * scale_2 + loc |
| 385 | ratio = scale_1 / (scale_1 + scale_2) |
| 386 | return torch.where(u < ratio, n_left, n_right).exp() |
| 387 | |
| 388 | |
| 389 | class FolderOfImages(data.Dataset): |
nothing calls this directly
no outgoing calls
no test coverage detected