TypeError: cannot assign 'torch.cuda.FloatTensor' as parameter 'weight' (torch.nn.Parameter or None expected)

Thank you @albanD, however l get the following error

***** RuntimeError: legacy constructor for device type: cpu was passed device type: cuda, but device type must be: cpu**