muellerzr / Practical-Deep-Learning-for-Coders-2.0

Notebooks for the "A walk with fastai2" Study Group and Lecture Series

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sizes of tensors must match except in dimension 0

matthewchung74 opened this issue · comments

Hi @muellerzr , in Lesson_1, on this line
dbunch.show_batch(max_n=9, figsize=(6,7))

I'm getting this error

RuntimeError                              Traceback (most recent call last)
<ipython-input-18-5a9f6693bc49> in <module>()
----> 1 dbunch.show_batch(max_n=9, figsize=(6,7))

12 frames
/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/collate.py in default_collate(batch)
     53             storage = elem.storage()._new_shared(numel)
     54             out = elem.new(storage)
---> 55         return torch.stack(batch, 0, out=out)
     56     elif elem_type.__module__ == 'numpy' and elem_type.__name__ != 'str_' \
     57             and elem_type.__name__ != 'string_':

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 180 and 403 in dimension 2 at /pytorch/aten/src/TH/generic/THTensor.cpp:689

Do you know if something in the API changed? I'm running a copy of your Lesson_1 in a colab. Also, thanks a ton for putting this together.

Thank you for pointing this out. Yes this is a bug in the library. I'll investigate if it's present in the current pip version too. I've made the dev's aware of this

Awesome. Thanks!

I've limited the install of fastai2. Once this issue is fixed in the main version we will use the newest versions.

Everything is fixed now in all the notebooks using the most recent version (not the old folders though)