torch-image-lerp
Linear 2D/3D image interpolation and gridding in PyTorch.
Why?
This package provides a simple, consistent API for
- sampling from 2D/3D images (
sample_image_2d()/sample_image_3d()) - inserting values into 2D/3D images (
insert_into_image_2d(),insert_into_image_3d)
Operations are differentiable and sampling from complex valued images is supported.
Installation
pip install torch-image-lerp
Usage
Sample from image
import torch
import numpy as np
from torch_image_lerp import sample_image_2d
image = torch.rand((28, 28))
# make an arbitrary stack (..., 2) of 2d coords
coords = torch.tensor(np.random.uniform(low=0, high=27, size=(6, 7, 8, 2))).float()
# sampling returns a (6, 7, 8) array of samples obtained by linear interpolation
samples = sample_image_2d(image=image, coordinates=coords)
The API is identical for 3D but takes (..., 3) coordinates and a (d, h, w) image.
Insert into image
import torch
import numpy as np
from torch_image_lerp import insert_into_image_2d
image = torch.zeros((28, 28))
# make an arbitrary stack (..., 2) of 2d coords
coords = torch.tensor(np.random.uniform(low=0, high=27, size=(3, 4, 2)))
# generate random values to place at coords
values = torch.rand(size=(3, 4))
# sampling returns a (6, 7, 8) array of samples obtained by linear interpolation
samples = insert_into_image_2d(values, image=image, coordinates=coords)
The API is identical for 3D but takes (..., 3) coordinates and a (d, h, w) image.
Metadata
Release files for torch-image-lerp 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| torch_image_lerp-0.0.5.tar.gz | 10.0 kB | With provenance | Details for torch_image_lerp-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| torch_image_lerp-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for torch_image_lerp-0.0.5-py3-none-any.whl |
Total release size: 18.2 kB
Release files / torch_image_lerp-0.0.5.tar.gz
| Download URL | torch_image_lerp-0.0.5.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9529a49e45f43b7c03180d0f178274d4e907e8b36ea9c5ee59e384993a7b1658
|
|
BLAKE2b-256 checksum How to use checksums |
1e8d7518e84668e5d36d81af9caf1de5835afc562ea32c27f7f768da1beaefca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 5, 2025.
Transparency logRelease files / torch_image_lerp-0.0.5-py3-none-any.whl
| Download URL | torch_image_lerp-0.0.5-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c280464bde667f6e795c5318af2e062a693a6d04e60c8bd5e3ba072cff3da759
|
|
BLAKE2b-256 checksum How to use checksums |
3defc8838232efd46f6cbc8ac6ddbf5f6fbecb72620107ae9daf2b8a147f6f7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 5, 2025.
Transparency logSecurity for torch-image-lerp 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for torch_image_lerp-0.0.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 5, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.