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.97k stars 256 forks source link

maml use miniimagenet is error #126

Closed lishuaijun1997 closed 2 years ago

lishuaijun1997 commented 3 years ago

This script is an example to showcase the MetaModule and data-loading features of Torchmeta, and as such has been very lightly tested. For a better tested implementation of Model-Agnostic Meta-Learning (MAML) using Torchmeta with more features (including multi-step adaptation and different datasets), please check https://github.com/tristandeleu/pytorch-maml. 0%| | 0/100 [00:02<?, ?it/s] Traceback (most recent call last): File "E:/小样本学习/代码5/pytorch-meta-master/examples/maml/train.py", line 131, in train(args) File "E:/小样本学习/代码5/pytorch-meta-master/examples/maml/train.py", line 63, in train train_logit = model(train_input) File "E:\pycharm\anaconda\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, *kwargs) File "E:\小样本学习\代码5\pytorch-meta-master\examples\maml\model.py", line 33, in forward logits = self.classifier(features, params=self.get_subdict(params, 'classifier')) File "E:\pycharm\anaconda\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(input, **kwargs) File "E:\小样本学习\代码5\pytorch-meta-master\torchmeta\modules\linear.py", line 14, in forward return F.linear(input, params['weight'], bias) File "E:\pycharm\anaconda\lib\site-packages\torch\nn\functional.py", line 1690, in linear ret = torch.addmm(bias, input, weight.t()) RuntimeError: mat1 dim 1 must match mat2 dim 0

Process finished with exit code 1