MetaNN provides extensions of PyTorch nn.Module for meta learning
In meta learner scenario, it is common use dependent variables as parameters, and back propagate the gradient of the parameters. However, parameters of PyTorch Module are designed to be leaf nodes and it is forbidden for parameters to have grad_fn. Meta learning coders are therefore forced to rewrite the basic layers to adapt the meta learning requirements.
This module provide an extension of torch.nn.Module, DependentModule that has dependent parameters, allowing the differentiable dependent parameters. It also provide the method to transform nn.Module into DependentModule, and turning all of the parameters of a nn.Module into dependent parameters.
pip install MetaNN
from metann import DependentModule, Learner from torch import nn net = torch.nn.Sequential( nn.Linear(10, 100), nn.Linear(100, 5)) net = DependentModule(net) print(net)
This won’t build correctly with the heavy dependency PyTorch, so I updated the sphinx built html to GitHub. I hate to use mock to solve This problem, I suggest you to clone the repository and view the html docs yourself.
Copyright (c) 2019-present, Hanqiao Yu
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size MetaNN-0.2.5-py3-none-any.whl (8.9 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size MetaNN-0.2.5.tar.gz (7.3 kB)||File type Source||Python version None||Upload date||Hashes View hashes|