Skip to main content

torch-bounds

Boundary conditions (circulant, mirror, reflect) and real transforms (DCT, DST) in PyTorch.

Overview

This small package implements a wide range of boundary conditions used to extrapolate a given discrete signal outside of its native bounds.

Based on these additional boundary conditions, it implements:

  • pad: an extension of torch.nn.functional.pad
  • roll: an extension of torch.roll

It also implements discrete sine and cosine transforms (variants 1, 2 and 3), using a trick similar to cupy.

Finally, it implements additional utilities:

  • ensure_shape crops or pads a tensor (with any boundary condition) so that it matches a give shape.
  • indexing is a module that implements functions to tranforms out-of-bounds coordinates into in-bounds coordinates according to any boundary condition.
  • types is a module that defines names and aliases for different boundary conditions, as well as tools to convert between different naming conventions.

Documentation

See our documentation and notebooks.

Installation

Dependency

  • torch >= 1.3
  • torch >= 1.8 if real transforms are needed (dct, dst)

Conda

conda install torch-bounds -c balbasty -c pytorch

Pip

pip install torch-bounds

Related packages

  • torch-interpol: B-spline interpolation with the same boundary conditions as those implemented here.
  • torch-distmap: Euclidean distance transform.

Metadata

Release files for torch-bounds 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torch-bounds 0.2.0
File Size Uploaded
torch_bounds-0.2.0.tar.gz 42.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for torch-bounds 0.2.0
File Interpreter ABI Platform
torch_bounds-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 68.8 kB

Release files / torch_bounds-0.2.0.tar.gz

Download URL torch_bounds-0.2.0.tar.gz
Size 42.7 kB
Tags Source
SHA-256 checksum
How to use checksums
731835f9f150486f221984d4ac048ce0df721e3e3f7d455f43ceab917990a699
BLAKE2b-256 checksum
How to use checksums
5cd743bb22df5cb664632207c8b1e58a18884c79542da36d0107042fba5ed10a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / torch_bounds-0.2.0-py3-none-any.whl

Download URL torch_bounds-0.2.0-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4975ba7b9eef746fd716b15493b5e6360217233fcd80de127dfdd7da1bdfb97a
BLAKE2b-256 checksum
How to use checksums
f02cbde84551a94a2a90d9695cee0e09e23d4521a09888bea4cc6ec8cc6dbb61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page