Hi,
Given 1D differentiable vectors A=[Nx1]
and B=[Mx1]
, I am looking to compute pairwise kernel operation .
def kernel(a, b):
a*b*torch.exp(-torch.abs(a-b)/0.4)
Is there a way to avoid looping over individual items? I need to perform the kernel operation for pairwise entries in {A, A}
, {A, B}
and {B, B}
which might make it computationally heavy if done iteratively.