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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torch_bounds-0.2.0.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torch_bounds-0.2.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file torch_bounds-0.2.0.tar.gz.

File metadata

  • Download URL: torch_bounds-0.2.0.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for torch_bounds-0.2.0.tar.gz
Algorithm Hash digest
SHA256 731835f9f150486f221984d4ac048ce0df721e3e3f7d455f43ceab917990a699
MD5 c0da6aadb2f49d1dbfe45ceb8c88dd64
BLAKE2b-256 5cd743bb22df5cb664632207c8b1e58a18884c79542da36d0107042fba5ed10a

See more details on using hashes here.

File details

Details for the file torch_bounds-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: torch_bounds-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for torch_bounds-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4975ba7b9eef746fd716b15493b5e6360217233fcd80de127dfdd7da1bdfb97a
MD5 61df03293d08014588e7e1a64cc588be
BLAKE2b-256 f02cbde84551a94a2a90d9695cee0e09e23d4521a09888bea4cc6ec8cc6dbb61

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page