I ran into a weird error where I cannot use torch.nn.functional.pdist after a certain tensor size. In my case it was 9999 or maybe I am missing something?
import math
import torch #version 1.0
import torch.nn.functional as F

sizes = [100, 1000, 3000, 5000, 7500, 8500, 9999, 10000]
for size in sizes:
    print("[{}] Start".format(size))
    a = torch.randn(size, 20).float().cuda()
    print("Before")
    # The operation
    b = F.pdist(a, p=2)
    print("After")
    a = torch.randn(size, 20).float().cuda()
    print("---End---")

I can use the result of pdist but I cant allocate new variables after that. And it give me this error
CUDA error: an illegal memory access was encountered.