Spaces:
Paused
Paused
Download modules/PartField/partfield/model/PVCNN/pv_module/functional/devoxelization.py from omnipart/OmniPart: direct link, hf CLI and curl.
- Browser
- Download file 426 Bytes
-
https://huggingface.co/spaces/omnipart/OmniPart/resolve/main/modules/PartField/partfield/model/PVCNN/pv_module/functional/devoxelization.py
- Command line
-
hf download hf://spaces/omnipart/OmniPart/modules/PartField/partfield/model/PVCNN/pv_module/functional/devoxelization.py
-
curl -L -o devoxelization.py https://huggingface.co/spaces/omnipart/OmniPart/resolve/main/modules/PartField/partfield/model/PVCNN/pv_module/functional/devoxelization.py
426 Bytes
| from torch.autograd import Function | |
| import torch | |
| import torch.nn.functional as F | |
| __all__ = ['trilinear_devoxelize'] | |
| def trilinear_devoxelize(c, coords, r, training=None): | |
| coords = (coords * 2 + 1.0) / r - 1.0 | |
| coords = coords.permute(0, 2, 1).reshape(c.shape[0], 1, 1, -1, 3) | |
| f = F.grid_sample(input=c, grid=coords, padding_mode='border', align_corners=False) | |
| f = f.squeeze(dim=2).squeeze(dim=2) | |
| return f | |