(x, y, r)
| 393 | |
| 394 | |
| 395 | def blur_stepfun(x, y, r): |
| 396 | xr, xr_idx = torch.sort(torch.cat([x - r, x + r], dim=-1)) |
| 397 | y1 = (torch.cat([y, torch.zeros_like(y[..., :1])], dim=-1) - |
| 398 | torch.cat([torch.zeros_like(y[..., :1]), y], dim=-1)) / (2 * r) |
| 399 | y2 = torch.cat([y1, -y1], dim=-1).take_along_dim(xr_idx[..., :-1], dim=-1) |
| 400 | yr = torch.cumsum((xr[..., 1:] - xr[..., :-1]) * |
| 401 | torch.cumsum(y2, dim=-1), dim=-1).clamp_min(0) |
| 402 | yr = torch.cat([torch.zeros_like(yr[..., :1]), yr], dim=-1) |
| 403 | return xr, yr |
nothing calls this directly
no outgoing calls
no test coverage detected