In tensorflow, creating a meshgrid is pretty easy
x_t, y_t = tf.meshgrid(tf.linspace(0.0, _width_f - 1.0, _width),
tf.linspace(0.0 , _height_f - 1.0 , _height))
How can I create a meshgrid in pytorch?
My try:
a = torch.linspace(0.0, _width_f - 1.0, _width)
b = torch.linspace(0.0 , _height_f - 1.0 , _height)
x_t = a.view(-1, 1).repeat(1, b.size(0))
y_t = b.view(1, -1).repeat(a.size(0), 1)