-
例如生成2D卷积核坐标
x, y = torch.meshgrid(torch.linspace(-1, 1, 3), torch.linspace(-1, 1, 3)) # x.size() is [3, 3] n_x_y = torch.cat((x.reshape(-1,1), y.reshape(-1,1)), 1)
- 得到的坐标为行索引坐标
生成3D卷积坐标
x, y, z = torch.meshgrid(torch.linspace(-1,1,3),
torch.linspace(-1,1,3),
torch.linspace(1,2,2))
# x.size() is [3, 3, 2]
# z.size() is [3, 3, 2]