Random Fourier Features for PyTorch
Project description
Random Fourier Features Pytorch
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
Built Distribution
Hashes for random-fourier-features-pytorch-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c0f0e66e4e44268f914c84fdaf23ed3a028b2abc9805341bc6eed63089a0b94 |
|
MD5 | 9bc1f8d181e1198f625337b8fb198168 |
|
BLAKE2b-256 | e11e5f530e74beda0694f661128342c3933461519585f7037167260dabf0a24a |
Hashes for random_fourier_features_pytorch-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fa5d6064c7c02b1d59c5f833d67eb1a766ee825a35206a13d0d590329d91ddc |
|
MD5 | ab37de7ff8e9abfa2bb77f85ef806470 |
|
BLAKE2b-256 | 233c7f9640af31636347313701433fa81db3762181aa83cac35382fae5881a38 |