Using custom dataset training on Pytorch and export to onnx

Hi, I’m a new hand to PyTorch and onnx, here is my problem:
I used custom dataset (csv file) to train a model on PyTorch and export to onnx model, which were used on visual studio. Now I can train and get good testing accuracy on Pytorch, but when I exported it to onnx model and used it on visual studio to test same dataset, it got low accuracy. Please help me to figure out my problem, thanks a lot!

Here is my code: