Skip to main content

Boundary conditions and real transforms in PyTorch

Project description

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.

Project details


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.1.1.tar.gz (42.5 kB view details)

Uploaded Source

Built Distribution

torch_bounds-0.1.1-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: torch_bounds-0.1.1.tar.gz
  • Upload date:
  • Size: 42.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for torch_bounds-0.1.1.tar.gz
Algorithm Hash digest
SHA256 72ca23330b62f3cd09de6daa0d8bfc959f3880fa3b9e0b463814ad351747019e
MD5 c09eb3633095e825bb09885d9685b0f4
BLAKE2b-256 cf7d000157b293cceaf8602fe56c9c9804c1278ebd02de8570d3f23160e05543

See more details on using hashes here.

File details

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

File metadata

  • Download URL: torch_bounds-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for torch_bounds-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fbc07d496675d114f5bad11046eac4821532f7f03e1baf50ddf0b25b3132e1a0
MD5 ee4b865c200a0ade6bbe502bacebb53b
BLAKE2b-256 6f9c835756df7cec769a6409412d5743974d532e26ed844d32028a5ba9bb62ca

See more details on using hashes here.

Supported by

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