INNER CODE UNIT · Python
means
nv-tlabs/ATISS · scene_synthesis/losses/__init__.py:63
means = pred[:, :, nr_mix:2 * nr_mix]
log_scales = torch.clamp(
pred[:, :, 2 * nr_mix:3 * nr_mix], min=log_scale_min
)
centered_y = target - means
inv_stdv = torch.exp(-log_scales)
plus_in = inv_stdv * (centered_y + 1. / (num_classes - 1))
cdf_plus = torch.sigmoid(plus_in)
min_in = inv_stdv * (centered_y - 1. / (num_classes - 1))
cdf_min = torch.sigmoid(min_in)
# log probability for edge case of 0 (before scaling)
# equivalent: torch.log(torch.sigmoid(plus_in))
log_cdf_plus = plus_in - F.softplus(plus_in)
# log probability for edge case of 255 (before scaling)
# equivalent: (1 - torch.sigmoid(min_in)).log()