I got a very similar error while trying to export my resnet model. The only difference is that the problem is ‘onnx::Sub’ instead of ‘onnx::Gather’ as in your case. I have not found the solution yet. I also have pytorch 1.4.0.
Let me know if you have the solution.