I’m not sure if PyTorch’s strength could shine in filling polygons, if you don’t need to differentiate through these operations (assuming they are even differentiable). You could take a look at e.g. Kornia which might provide similar methods already. CC @edgarriba