Run problem in face age estimation

when i want to make a age estimation with the dataset from UTKFace , and i use the linear regression result as a out layer, and when i run i have the error:

RuntimeError: Expected object of scalar type Float but got scalar type Long for argument #2 ‘target’

and my code is like the picture:



does any one know how to fix it , thank you. my email is 2242988415@qq.com.

Your targets should be type float. So convert them to torch.float in the dataset.