ah cool, did it also solve the initial problem? The thing here is that torch::form_blob directly reads out the memory. Your image probably was of type byte, which equals 8 bits per pixel. By calling at::kFloat, torch::form_blob moved 32 bits per pixel instead of 8 bits per pixel while reading the memory. This most likely led to  ‘Zugriffsverletzung beim Lesen an Position’, as it tried to access memory which was not allocated.