Hi and Thanks for creating this library!
I have a problem and pykeops seems to be a good frame work.
I have 2 tensors x of shape B, M, D and y of shape B, N, D and I want to compute the distance matrix between these two tensors, resulting in a tensor of shape B, M, N.
The usual code in pytorch is
import torch
B = 128
M = 1024
N = 1024
D = 1024
x = torch.randn(B, M, D, device='cuda')
y = torch.randn(B, N, D, device='cuda')
dist = (x.unsqueeze(2) - y.unsqueeze(1)).pow(2).sum(dim = -1)
I've tried using pykeops:
a_i = LazyTensor(x.unsqueeze(1)) # shape (7, 1, 5, 3)
b_j = LazyTensor(y.unsqueeze(2)) # shape (7, 5, 1, 3)
c = (a_i - b_j).sum(dim=-1)
but c is still a LazyTensor. How could I perform the computation?
Thanks for your help!
Hi and Thanks for creating this library!
I have a problem and pykeops seems to be a good frame work.
I have 2 tensors
xof shapeB, M, Dandyof shapeB, N, Dand I want to compute the distance matrix between these two tensors, resulting in a tensor of shapeB, M, N.The usual code in pytorch is
I've tried using pykeops:
but
cis still a LazyTensor. How could I perform the computation?Thanks for your help!