Perfect Spatial Hashing in PyTorch
Project description
perfecthash-pytorch
Perfect Spatial Hashing in PyTorch
Usage
Install the library with:
pip install git+https://github.com/dli7319/psh-pytorch.git
Instantiate a PerfectSpatialHash object with:
from psh_pytorch import PerfectSpatialHash
occupancy_grid # A 2D (or higher dimensional) occupancy grid
out_features = 3
perfect_hash = PerfectSpatialHash(
occupancy_grid, out_features)
# 2D forward pass
indices = torch.stack(torch.meshgrid(
torch.arange(128, device=device),
torch.arange(128, device=device),
indexing='ij'), -1)
values, sparsity = perfect_hash(indices.reshape(-1, 2))
# Values are of shape (128 * 128, 3)
# Sparsity is of shape (128 * 128)
# Note that values are unmasked
masked_values = values * sparsity.unsqueeze(-1)
Examples
See examples/ for a simple example of how to use the library.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
psh-pytorch-0.0.1.tar.gz
(6.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file psh-pytorch-0.0.1.tar.gz.
File metadata
- Download URL: psh-pytorch-0.0.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d3559a3779f7eec14bdf7e5ca5b9477e696405c1229864829d8003b036acc0d
|
|
| MD5 |
3931041b6c5066b6bf024e3f648cb01a
|
|
| BLAKE2b-256 |
a9082b2b90d1a9b99cb2f555de05d99da0fecfc771c086411243549b864da1ba
|
File details
Details for the file psh_pytorch-0.0.1-py3-none-any.whl.
File metadata
- Download URL: psh_pytorch-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2874ad20737c91bd0fe7c0aac995fff7cf79caa7194e96f85ce6377f2e06bd0f
|
|
| MD5 |
6710440b9c44116055fba51a415bfa24
|
|
| BLAKE2b-256 |
93c33911821e2ab373f99ca90c0333b8dc06b078f5993685974f6422dae7eed3
|