Open heixi opened 6 years ago
This notebook used version 0.3. (Pytorch version 0.4 was released in April, where for instance the "Variable" object was deprecated, in case that causes any issues.)
I met a problem at line 93 ,"data=torch.from_numpy(np.stack(data))" in function prep_train_loader(img_path), and the error "RuntimeError: can't convert a given np.ndarry to a tensor - it has an invalid type. The only supporterd types are: double, float, int64, int32, and uint8". Thanks
Hi weiQiangGe, perhaps it's due to numpy/pytorch updates since the commit (I was using numpy 1.13.3 & pytorch 0.3 when last updating this, and didn't encounter that error then.)
I think the potentially problematic bit may be using np.stack to concatenate the "data" list of images (which are, themselves, already in torch float tensor format, hence causing a type confusion).
You could try replacing the line torch.from_numpy(np.stack(data)) with torch.stack(data) and see if that fixes it.
However, if you're on pytorch 0.4, there may be further issues later in the script (see my comment on the Variable() object above, which is still in this version as I havent had time to update the entire notebook.)
I will try this method. Thank you.
could you tell me the version of your toch?