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.
wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
and then paste the results of your environment in the issue linked above?