Skip to main content

Random Fourier Features for PyTorch

Project description

Random Fourier Features Pytorch

Python package Coverage Status Documentation Status

PyPI Downloads

Random Fourier Features Pytorch is an implementation of "Fourier Features Let Networks Learn High Frequency Functions in Low Dimensional Domains" by Tancik et al. designed to fit seamlessly into any PyTorch project.

Installation

Use the package manager pip to install the package.

pip install random-fourier-features-pytorch

Usage

See the documentation for more details, but here are a few simple usage examples:

Gaussian Encoding

import torch
import rff

X = torch.randn((256, 256, 2))
encoding = rff.layers.GaussianEncoding(sigma=10.0, input_size=2, encoded_size=256)
Xp = encoding(X)

Basic Encoding

import torch
import rff

X = torch.randn((256, 256, 2))
encoding = rff.layers.BasicEncoding()
Xp = encoding(X)

Positional Encoding

import torch
import rff

X = torch.randn((256, 256, 2))
encoding = rff.layers.PositionalEncoding(sigma=1.0, m=10)
Xp = encoding(X)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Citation

If you end up using this repository, please cite it as:

@article{long2021rffpytorch,
  title={Random Fourier Features Pytorch},
  author={Joshua M. Long},
  journal={GitHub. Note: https://github.com/jmclong/random-fourier-features-pytorch},
  year={2021}
}

also cite the original work

@misc{tancik2020fourier,
      title={Fourier Features Let Networks Learn High Frequency Functions in Low Dimensional Domains}, 
      author={Matthew Tancik and Pratul P. Srinivasan and Ben Mildenhall and Sara Fridovich-Keil and Nithin Raghavan and Utkarsh Singhal and Ravi Ramamoorthi and Jonathan T. Barron and Ren Ng},
      year={2020},
      eprint={2006.10739},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

License

This is released under the MIT license found in the LICENSE file.

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

random-fourier-features-pytorch-1.0.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file random-fourier-features-pytorch-1.0.1.tar.gz.

File metadata

File hashes

Hashes for random-fourier-features-pytorch-1.0.1.tar.gz
Algorithm Hash digest
SHA256 04127161c5eae37a5dd4ea108acc5b934a8f702ca40457f9ef5cfc5268344bf8
MD5 e6bf9c52b0e33fe3563a634baef51c31
BLAKE2b-256 59f504f38f754ebfdf19e9328d3a06c5ca2abc222448f18a7d6915856bcbfd18

See more details on using hashes here.

File details

Details for the file random_fourier_features_pytorch-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for random_fourier_features_pytorch-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1f3c01e15e8d5c9902b7cc67ca71b056a1c90768bb3d57f45b1043be29808534
MD5 fc3715ff25f4d1202e082867aae6e5eb
BLAKE2b-256 79f8bdc1b5c8cb52fb0a46076b56cd1b8f1fe2e905f8e9b66b7774a0f1a6b8eb

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page