Skip to content

Instantly share code, notes, and snippets.

View justanhduc's full-sized avatar
:shipit:
Pythoning. Pytorching. And Githubing

Duc Nguyen justanhduc

:shipit:
Pythoning. Pytorching. And Githubing
View GitHub Profile
@justanhduc
justanhduc / bpp.py
Last active November 24, 2020 13:07
def batch_pairwise_sqdist(x: T.Tensor, y: T.Tensor):
"""
Calculates the pair-wise square distance between two sets of points.
To get the Euclidean distance, explicit square root needs to be applied
to the output.
:param x:
a tensor of shape ``(m, nx, d)`` or ``(nx, d)``.
If the tensor dimension is 2, the tensor batch dim is broadcasted.
:param y:
@justanhduc
justanhduc / log.txt
Created December 24, 2019 08:20
EMD installation log
(base) justanhduc@insight-SIM3:~/Downloads/MSN-Point-Cloud-Completion/emd$ python setup.py install
running install
running bdist_egg
running egg_info
writing emd.egg-info/PKG-INFO
writing dependency_links to emd.egg-info/dependency_links.txt
writing top-level names to emd.egg-info/top_level.txt
reading manifest file 'emd.egg-info/SOURCES.txt'
writing manifest file 'emd.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
@justanhduc
justanhduc / pc2voxel.py
Last active March 8, 2023 20:00
PyTorch pointcloud to voxel
import neuralnet_pytorch as nnt
import torch as T
from torch_scatter import scatter_add
def pointcloud2voxel_fast(pc: T.Tensor, voxel_size: int, grid_size=1., filter_outlier=True):
b, n, _ = pc.shape
half_size = grid_size / 2.
valid = (pc >= -half_size) & (pc <= half_size)
valid = T.all(valid, 2)
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\justanhduc\Anaconda3\lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib/x64" /LIBPATH:C:\Users\justanhduc\Anaconda3\libs /LIBPATH:C:\Users\justanhduc\Anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" cudart.lib c10.lib c10_cuda.lib torch.lib torch_python.lib _C.lib /EXPORT:PyInit__C build\temp.win-amd64-3.7\Release\Users\justanhduc\Downloads\nestedtenso
@justanhduc
justanhduc / log.txt
Created December 13, 2019 05:01
error building nested tensor
(base) justanhduc@insight-SIM3:~/Downloads/nestedtensor$ python setup.py develop
Building wheel nestedtensor-0.0.1.dev201912134+bef337d
running develop
running egg_info
creating nestedtensor.egg-info
writing nestedtensor.egg-info/PKG-INFO
writing dependency_links to nestedtensor.egg-info/dependency_links.txt
writing requirements to nestedtensor.egg-info/requires.txt
writing top-level names to nestedtensor.egg-info/top_level.txt
writing manifest file 'nestedtensor.egg-info/SOURCES.txt'