Hi @ptrblck  I appreciate you took the time and look into the error and you are right:
‘’’
[0.41960784 0.42352941 0.22745098 … 0.04705882 0.01568627 0.04705882]
[0.41960784 0.43529412 0.18431373 … 0.         0.         0.        ]
[0.41568627 0.43921569 0.15294118 … 0.         0.         0.        ]]]
img shape float64
index of the image in get target 20
img shape (3, 224, 224)
‘’’
the dtype of the img (object of  ndarray ) is float64
on my input tensor x I updated the code as showing below and I can confirm it is returning float32 from the debugging image attached after I updated the code into dtype:torch.float32
x=data.to(device=self.device, dtype=torch.float32)
image1278×37 8.5 KB
however I am still getting the same error, I added after the above code x = x.float()
but didnt change my input dtype as the picture below showing:
image1359×142 30.2 KB
this is the flow currently I have from Image 244*244 → store into data of a numpy array → img = data [index] → forward x= data.to(device=self.device, dtype=torch.float32) → x = x.float() to the model
I am still getting the same error