Turn a model from double into float

Dear all, Hi!

I am recently managing to use float32 as the precision of my model. The pytorch program on my computer seems to use “double” precision by default. I find it straight forward to cast a tensor from double to float, but how to define the precision of a model?

Thank you for your time and help!

1 Like

Hi,

It will do the job:

model = model.to(torch.float)

Bests

1 Like

Thank you! It works!