(feature, flow, mask=False, mode="bilinear", padding_mode="zeros")
| 81 | |
| 82 | |
| 83 | def flow_warp(feature, flow, mask=False, mode="bilinear", padding_mode="zeros"): |
| 84 | b, c, h, w = feature.size() |
| 85 | assert flow.size(1) == 2 |
| 86 | |
| 87 | grid = coords_grid(b, h, w).to(flow.device) + flow # [B, 2, H, W] |
| 88 | grid = grid.to(feature.dtype) |
| 89 | return bilinear_sample(feature, grid, mode=mode, padding_mode=padding_mode, return_mask=mask) |
| 90 | |
| 91 | |
| 92 | def forward_backward_consistency_check(fwd_flow, bwd_flow, alpha=0.01, beta=0.5): |
no test coverage detected