-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: No module named 'knn' #23
Comments
I get the same error whenever I try to import knn_cuda !
|
19/5000 |
I met the same problem, have you solved it? |
Try this function:
def knn(pc,n_neighbors=11):
dist = torch.cdist(pc,pc)
neigbhors = dist.topk(k=n_neighbors,dim=2,largest=False)
#print(neigbhors.indices.shape)
knn_values = pc[:,torch.squeeze(neigbhors.indices[:,:,1:n_neighbors+1])]
l2 = torch.tensor(0)
h = 20
#eps = 1
for j in range(5):
l2 = l2 + torch.sum((torch.squeeze(knn_values)[:, j, :] -
torch.squeeze(pc))**2)
#dist2 = torch.max(l2, torch.tensor(eps))
dist2 = l2
dist = torch.sqrt(dist2)
weight = torch.exp(- dist2 / h ** 2)
# uniform_loss = torch.mean((self.radius - dist) * weight)
uniform_loss = torch.mean((0.01 - dist) * weight) # punet
return uniform_loss
Le mar. 7 sept. 2021 à 03:56, njnj0314 ***@***.***> a écrit :
… 19/5000
I met the same problem, have you solved it?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#23 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJBI2W72HJZDK3Q7J3FLTQLUAVWL7ANCNFSM436DX43Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
the function torch.cdist cloud compute the distance. I have written the function
|
when I trying the command:
python train.py --exp_name=PUGAN-pytorch-master --gpu=0 --use_gan --batch_size=12
it appears the following error:
Traceback (most recent call last):
File "train.py", line 14, in
from network.networks import Generator,Discriminator
File "../network/networks.py", line 6, in
from knn_cuda import KNN
File "/media/cx/新加卷1/xxl1/lib/python3.7/site-packages/knn_cuda/init.py", line 38, in
_knn = load_cpp_ext("knn")
File "/media/cx/新加卷1/xxl1/lib/python3.7/site-packages/knn_cuda/init.py", line 33, in load_cpp_ext
with_cuda=True
File "/media/cx/新加卷1/xxl1/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1091, in load
keep_intermediates=keep_intermediates)
File "/media/cx/新加卷1/xxl1/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1317, in _jit_compile
return _import_module_from_library(name, build_directory, is_python_module)
File "/media/cx/新加卷1/xxl1/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1701, in _import_module_from_library
file, path = imp.find_module(module_name, [path])
File "/media/cx/新加卷1/xxl1/lib/python3.7/imp.py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'knn'
I have installed the KNN_CUDA mentioned in readme.md
I checked a lot on the Internet, but didn't solve the problem.
The text was updated successfully, but these errors were encountered: