[Multiple & Parallel Fully connected layers]: type torch.cuda.FloatTensor but found type torch.FloatTensor

Hi:
I am making multiple & parallel fc layers in my network
However, Code in below image**(line 27)** causes error:
RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.FloatTensor for argument #2 'mat2’

  1. What is the problem ?
  2. Is there any better way to implement multiple & parallel fc layers?

image

Currently self.classifier is a plain Python list, which won’t be properly registered and pushed to the device.
Could you try to use self.classifier = nn.ModuleList() instead and run your code again?

1 Like