UserWarning: ONNX export failed on upsample_bilinear2d because align_corners == True not supported

When I run my model, I got a piece of warning,

E:\SoftWare\Anaconda3\lib\site-packages\torch\onnx\symbolic.py:69: UserWarning: ONNX export failed on upsample_bilinear2d because align_corners == True not supported
  warnings.warn("ONNX export failed on " + op + " because " + msg + " not supported")

How should I avoid or deal with it? Actually, I didn’t even know why I get this warning and which code may trigger it?
Maybe you can give me the answer,thanks.

This is a snippet of code that I think might trigger a warning.

class MyUpsamplingBilinear2d(nn.Module):
    def __init__(self,size=None,scale_factor=None,mode='bilinear', align_corners=True):
        super(MyUpsamplingBilinear2d,self).__init__()
        self.size=size
        self.scale_factor=scale_factor
        self.mode=mode
        self.align_corners=align_corners

    def forward(self, input):
        return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners)

I don’t know anything about ONNX, but it seems like your input has 4 dimensions + your mode being bilinear will result in this line being called, which is apparently not supported by ONNX yet?

To be more precise, either the operation upsample_bilinear2d is not supported yet, or the operation upsample_bilinear2d with option align_corners=True is not supported yet…

Thank you for your reply