code: def test_upsample(self):
      class MyModule(Module):
          def forward(self, x):
              size = [v * 2 for v in x.size()[2:]]
              size = [int(i) for i in size]
              return torch.nn.functional.interpolate(
                  x, size=size, mode="nearest"
              )
  
      module = MyModule()
      ops8 = [
          {
              "op_name": "Upsample",
              "attributes": [
                  {"name": "mode", "s": (b"nearest"), "type": 3},
                  {
                      "name": "scales",
                      "floats": [1.0, 1.0, 2.0, 2.0],
                      "type": 6,
                  },
              ],
          }
      ]
      ops9 = [
          {"op_name": "Constant"},
          {
              "op_name": "Upsample",
              "attributes": [
                  {"name": "mode", "s": (b"nearest"), "type": 3}
              ],
          },
      ]
      ops = {8: ops8, 9: ops9}
      x = torch.randn(2, 2, 2, 2)
      check_onnx_opsets_operator(module, x, ops, opset_versions=[8, 9])
  
imports: import io
  import itertools
  import onnx
  import pytorch_test_common
  import torch
  import torch.onnx
  from torch.nn import Module
  from torch.onnx import producer_name, producer_version
  from torch.onnx._globals import GLOBALS
  from torch.testing._internal import common_utils
label_desc: Use image node_id 4 for calling the TestONNXOpset obj's underlying member method code with example usage: obj.test_upsample() and returns: torch