Frame Averaging - Pytorch
Pytorch implementation of a simple way to enable (Stochastic) Frame Averaging for any network. This technique was recently adopted by Prescient Design in AbDiffuser
Install
$ pip install frame-averaging-pytorch
Usage
import torch
from frame_averaging_pytorch import FrameAverage
# contrived neural network
net = torch.nn.Linear(3, 3)
# wrap the network with FrameAverage
net = FrameAverage(
net,
dim = 3, # defaults to 3 for spatial, but can be any value
stochastic = True # whether to use stochastic variant from FAENet (one frame sampled at random)
)
# pass your input to the network as usual
points = torch.randn(4, 1024, 3)
mask = torch.ones(4, 1024).bool()
out = net(points, frame_average_mask = mask)
out.shape # (4, 1024, 3)
# frame averaging is automatically taken care of, as though the network were unwrapped
or you can also carry it out manually
import torch
from frame_averaging_pytorch import FrameAverage
# contrived neural network
net = torch.nn.Linear(3, 3)
# frame average module without passing in network
fa = FrameAverage()
# pass the 3d points and mask to FrameAverage forward
points = torch.randn(4, 1024, 3)
mask = torch.ones(4, 1024).bool()
framed_inputs, frame_average_fn = fa(points, frame_average_mask = mask)
# network forward
net_out = net(framed_inputs)
# frame average
frame_averaged = frame_average_fn(net_out)
frame_averaged.shape # (4, 1024, 3)
Citations
@article{Puny2021FrameAF,
title = {Frame Averaging for Invariant and Equivariant Network Design},
author = {Omri Puny and Matan Atzmon and Heli Ben-Hamu and Edward James Smith and Ishan Misra and Aditya Grover and Yaron Lipman},
journal = {ArXiv},
year = {2021},
volume = {abs/2110.03336},
url = {https://api.semanticscholar.org/CorpusID:238419638}
}
@article{Duval2023FAENetFA,
title = {FAENet: Frame Averaging Equivariant GNN for Materials Modeling},
author = {Alexandre Duval and Victor Schmidt and Alex Hernandez Garcia and Santiago Miret and Fragkiskos D. Malliaros and Yoshua Bengio and David Rolnick},
journal = {ArXiv},
year = {2023},
volume = {abs/2305.05577},
url = {https://api.semanticscholar.org/CorpusID:258564608}
}
Metadata
Release files for frame-averaging-pytorch 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| frame_averaging_pytorch-0.1.2.tar.gz | 221.1 kB | Without provenance | Details for frame_averaging_pytorch-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| frame_averaging_pytorch-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for frame_averaging_pytorch-0.1.2-py3-none-any.whl |
Total release size: 227.1 kB
Release files / frame_averaging_pytorch-0.1.2.tar.gz
| Download URL | frame_averaging_pytorch-0.1.2.tar.gz |
|---|---|
| Size | 221.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca086d73c3c8dfd9b2fc6b0a6f5a696e958ef338cb84e25fdf0fac39d5d4d6ff
|
|
BLAKE2b-256 checksum How to use checksums |
8af775b734e7f5bab7be79bf5ae98d4daeeb4991a52477c2fcbcbf564b5de94c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / frame_averaging_pytorch-0.1.2-py3-none-any.whl
| Download URL | frame_averaging_pytorch-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d76cbc0a5f1db23239de8ca4bf0805da750b4582c98f6c8fc2775b5063961d8
|
|
BLAKE2b-256 checksum How to use checksums |
d045e986e4d4a17e712ab6525c1baefcca58d079f1d84993c2de7848da34b464
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Security for frame-averaging-pytorch 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.