Upsample ONNX gives INVALID_GRAPH when trying to convert bilinear layer to onnx
when i convert network with bilinear layer trained on Pytorch to ONNX, i get following error


  RuntimeError: [ONNXRuntimeError] : 10 : INVALID_GRAPH : Load model
  from test.onnx failed:Type Error: Type 'tensor(int64)' of input
  parameter (11) of operator (Floor) in node () is invalid.


I m not sure on why this error occurs, I tried building ONNX from source but still the issue dosen't seems to go way.

Any ideas on what might cause this error? or how to tackle the issue?

Way to Reproduce-

from torch import nn

import torch
import torch.nn.functional as F
import onnxruntime as rt

class Upsample(torch.nn.Module):
    def forward(self, x):
        #l = nn.Conv2d(3, 3, kernel_size=1, stride=1, padding=1, bias=True)
        return F.interpolate(x, scale_factor=2, mode="bilinear", align_corners=False)

m = Upsample()
v = torch.randn(1,3,128,128, dtype=torch.float32, requires_grad=False)

torch.onnx.export(m, v, "test.onnx")
sess = rt.InferenceSession("test.onnx")


This error has been fixed in https://github.com/pytorch/pytorch/pull/21434 (the fix is in functional.py), so you should be able to get it if you install pytorch's nightly build.

However, in this same PR, converting Upsample in bilinear mode has been disabled; the reason is that Pytorch's bilinear mode does not align with ONNX's, and Nearest mode is the only mode currently supported.

Upsample (Now called Resize) in ONNX is being updated in opset 11 to support a bilinear mode that aligns with Pytorch in https://github.com/onnx/onnx/pull/2057, but this is not yet pushed.
