For future reference, this PR fixes the following warning during tracing for ONNX model export:
Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
For future reference, this PR fixes the following warning during tracing for ONNX model export:
However, due to https://github.com/pytorch/pytorch/issues/27551 this change can't be made until we upgrade to PyTorch 1.5.0 otherwise tracing (and hence ONNX export) breaks completely.