Hi, came across this error. Can anyone help me please?

In the code:

Q: Convert the numpy arrays inputs_array and targets_array into PyTorch tensors. Make sure that the data type is torch.float32.

inputs = torch.tensor(inputs_array, dtype=torch.float32)
targets = torch.tensor(targets_array, dtype=torch.float32)

Make sure you have the “dtype=torch.float32”. If you do not have it the data will be float64, I thought that was ok, however, it only works for me when transforming the data to float32.

Luis

2 Likes

@lui-geraldino Thanks man … It works!

i think u change your loss function to
F.l1_loss(out,targets) in InsuranceModel class

1 Like

Thanks for suggesting. I shall try it out

yes Hopefully it works

I guess your val_loader has a problem.