Hi,
My network has two layers; the first one is a cnn layer and the second is a linear layer. Also, I try to use gpu for running it. The linear layer is as following:
self.fc1 = nn.Linear(rows_num_after_convolution, 1).to(torch.device("cuda:0"), dtype=torch.half, non_blocking=True)

but I receive this error:
Traceback (most recent call last):
  File "MyCNNCustomized_v6_based_on_MyCNN13.py", line 576, in <module>
    outputs = net(current_image)
  File "/home/zahra/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "MyCNNCustomized_v6_based_on_MyCNN13.py", line 281, in forward
    x = torch.atan(self.fc1(self.convZ.output_after_pooling.squeeze(0).squeeze(1)))
  File "/home/zahra/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/zahra/.local/lib/python2.7/site-packages/torch/nn/modules/linear.py", line 92, in forward
    return F.linear(input, self.weight, self.bias)
  File "/home/zahra/.local/lib/python2.7/site-packages/torch/nn/functional.py", line 1408, in linear
    output = input.matmul(weight.t())
RuntimeError: Expected object of backend CPU but got backend CUDA for argument #2 'mat2'

I would appreciate it if anyone could guide me.
Many thanks before all