Weight type float16

I want to feed the model type float16. But I get the error RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same. How do I set weight type float16?

Did you try m.to(dtype=torch.half)?

Best regards

Thomas