Ah, right, the torchvision transform in your snippet had me confused. How do you check c++ and Python produce the same output? I would probably stuck the c++ code into an extension to check each step.