A Minimal Relational Function
PyTorch/Numpy agnostic function implementing the relational block from "A simple neural network module for relational reasoning".
I wrote this to learn how to use nbdev. I'm pretty sure it's correct but it only implements the core function for using relational networks and none of the other stuff (such as nn.Module classes etc) that Kai included in the pull request.
The original paper can be found here.
Install
pip install relational
How to use
This can be used to implement a relational network in PyTorch. An example would be something like:
from relational.core import relation
import torch
import torch.nn as nn
class SetNet(nn.Module):
def __init__(self, datadim, n_hidden):
super(SetNet, self).__init__()
self.n_hidden = n_hidden
self.g = nn.Sequential(nn.Linear(datadim*2, n_hidden),
nn.ReLU(),
nn.Linear(n_hidden, n_hidden))
self.f = nn.Sequential(nn.Linear(n_hidden, n_hidden),
nn.ReLU(),
nn.Linear(n_hidden, n_hidden))
def forward(self, x):
n, t, d = x.size()
x = relation(x, self.g, reduction='mean')
return self.f(x)
x = torch.randn(4, 8, 16)
setnet = SetNet(x.size(2), 10)
setnet(x).size()
torch.Size([4, 10])
Metadata
Release files for relational 0.0.1
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 |
|---|---|---|---|---|
| relational-0.0.1.tar.gz | 10.5 kB | Without provenance | Details for relational-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| relational-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for relational-0.0.1-py3-none-any.whl |
Total release size: 18.4 kB
Release files / relational-0.0.1.tar.gz
| Download URL | relational-0.0.1.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d59d45465b39380ed1b6f4a5c272aa9c5f32fa59cf7c9615eacfa1334be704f
|
|
BLAKE2b-256 checksum How to use checksums |
06a1124e6f45d9a88c8168fef64ed54b0d40131eebb075106a18c0420d4d5a27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
|
Release files / relational-0.0.1-py3-none-any.whl
| Download URL | relational-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
888003da117b268c1acd13dec8a0d1ad267165994a542f79cd64c28ca3e919f0
|
|
BLAKE2b-256 checksum How to use checksums |
c808846dd4f44b192b7d473e8d2002b6aa680b387fe3ba640038aec2c09620bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
|
Security for relational 0.0.1
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.