lukemelas / EfficientNet-PyTorch

A PyTorch implementation of EfficientNet
Apache License 2.0
7.91k stars 1.53k forks source link

RuntimeError: expected type torch.cuda.FloatTensor but got torch.FloatTensor #34

Closed lightfate closed 5 years ago

lightfate commented 5 years ago

Hi, @lukemelas ~ I'm so excited about your code, but today, after i upgrade the pip package today, a new problem appeared:


C:\ProgramData\Anaconda3\lib\site-packages\efficientnet_pytorch\utils.py in drop_connect(inputs, p, training) 72 random_tensor += torch.rand([batch_size, 1, 1, 1], dtype=inputs.dtype) # uniform [0,1) 73 binary_tensor = torch.floor(random_tensor) ---> 74 output = inputs / keep_prob * binary_tensor 75 return output 76 RuntimeError: expected type torch.cuda.FloatTensor but got torch.FloatTensor


I sure that i don't change any of my code, just upgrade the pip package "efficientNet-Pytroch" in my code, i use your model like:


from efficientnet_pytorch import EfficientNet modelPre = EfficientNet.from_pretrained('efficientnet-b0')


lukemelas commented 5 years ago

See https://github.com/lukemelas/EfficientNet-PyTorch/issues/32

This is fixed in master :)

lightfate commented 5 years ago

See #32

This is fixed in master :)

Thanks~