Assignment 2 - Insurance cost prediction

In the assingnement 2 of this course I got to the conversion of numpy arrays into PyTorch tensors. I converted with torch.tensor() fuction and it returned a torch.float64 tensor. The assignment tells me to make sure it is a torch.float32 tensor data type. Is this a real problem and I can proceed to the next section, or do I have to check if anyhting is wrong?! Thanks for anyone who could feedback!

convert it to float32 using torch.tensor()

1 Like

I figured that out! I realised I had a syntax error with torch.nn.Module instead!

Is this a real problem and I can proceed to the next section(…)?!

I’m also curious about this! I did convert to float32 but don’t know the differences or when is it required/prefered to choose 32 vs 64.

Anyone care to chip in?

In this 2nd assignment i had tried different types of loss function like mse, SGD,L1 etc. But i didn’t understand that why loss is none while using MSE. Anyone please give me a brief regarding it.

actually MSE is only giving none values for high learning rates 1e-2 and 1e-3.
for more information regarding this i provided a link below

if you check (model.linear.weight).dtype you will find that weights are of float32 while your input value to the model is of float64, that is the why you got an error saying expected float32 but got double