[Python] Pytorch meshgrid

Discussão em 'Python' iniciado por Stack, Outubro 2, 2024.

  1. Stack

    Stack Membro Participativo

    I'm currently using torch 1.12 for my thesis on neural A star algorithm and i'm not quite sure what meshgrid does. For example why

    x = torch.tensor([1, 2, 3])
    y = torch.tensor([4, 5, 6])
    torch.meshgrid(x, y)


    return

    tensor([[1, 1, 1], [2, 2, 2], [3, 3, 3]])
    tensor([[4, 5, 6], [4, 5, 6], [4, 5, 6]])


    and not

    tensor([[1, 1, 1], [2, 2, 2], [3, 3, 3]])
    tensor([[4, 4, 4], [5, 5, 5], [6, 6, 6]])

    Continue reading...

Compartilhe esta Página