Solved using broadcasting where functor is an elementwise op and x,y are 1D vectors
326         range_tensor = torch.arange(n, out=torch.FloatTensor()).reshape(-1, 1)
327         foo = functor(x.reshape(1, -1) - range_tensor)
328         bar = functor(y.reshape(1, -1) - range_tensor)