Solved by ptrblck in post #2 
              
              
                Based on the error message it seems you are not transforming the PIL.Image to a tensor, so I guess in your code the transform argument might not be set properly. Note that your posted code snippet uses root_dir instead of img_dir, soI assume your real code is not using the same posted code. 
To furt…