How can I apply many data batches to a function on GPU
How can I apply many data batches to a function on GPU using PL? I like to do something similar to SPMD in MATLAB.
As an example, assume that I have 5 batches of 64 2D-points. I can generate it by
p_batch=torch.randn(5,64,2)#five batches of points, 64 points in each batch, two dimesnions
I want to apply the following function to each set of the 64 points.
def MyFunction(p,r,Orig_Window,Area,h,pi):#p.shape is 64,2
  correction=torch.empty(p.shape[0],p.shape[0])
  for i in range(p.shape[0]):
    for j in range(p.shape[0]):
      other_polygon =translate(Orig_Window, xoff=p[i,0]-p[j,0], yoff=p[i,1]-p[j,1])
      correction[i,j] = Area/Orig_Window.intersection(other_polygon).area
 
  d=torch.cdist(p,p)+10000*torch.eye(p.shape[0])

  Save=torch.empty(r.shape[0])
  for R in range(r.shape[0]):
    Logic=(d<=r[R])
    Save[R]=(correction*Logic).sum()
  ...
  return ...

Is there any way that I can process all the five point clouds (or batches) in parallel using one GPU?