tristandeleu / pytorch-meta

A collection of extensions and data-loaders for few-shot learning & meta-learning in PyTorch
https://tristandeleu.github.io/pytorch-meta/
MIT License
1.98k stars 256 forks source link

how to use lstm with torchmeta, pls? #141

Open AndrewHYC opened 3 years ago

brando90 commented 3 years ago

what issues are you having? torche meta is just a dataloader library, it should be easy (but tedious) to do it since there is nothing that stops torchmeta from working. The model is usually a seperate thing...

tristandeleu commented 3 years ago

I assume that you would like to use an LSTM as a MetaModule, in order to be able to backpropagate through an update (like in MAML)?

Unfortunately at the moment, there is no LSTM MetaModule; however, you could create one by taking the nn.LSTM module in PyTorch, and converting it to a functional module. See the comparison between nn.Linear and MetaLinear for inspiration.

Another option, that would work out of the box with any PyTorch module is to use higher. You can check out this example on how to use Torchmeta and higher together.

Hope this helps!