Is there a simple way to do stand-alone dilation in pytorch? Ideally it would be using a layer, but a function is okay if there is no layer available. I am not looking for a custom solution.
In this example, we want to pass x to the function to produce y.
import torch
x = torch.tensor([[
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
]])
y = torch.tensor([[
[1, 0, 1, 0, 1, 0, 1],
[0, 0, 0, 0, 0, 0, 0],
[1, 0, 1, 0, 1, 0, 1],
[0, 0, 0, 0, 0, 0, 0],
[1, 0, 1, 0, 1, 0, 1],
[0, 0, 0, 0, 0, 0, 0],
[1, 0, 1, 0, 1, 0, 1],
]])