code: def test_interpolate(self):
      class MyModel(torch.nn.Module):
          def forward(self, x):
              size = [v * 2 for v in x.size()[2:]]
              return torch.nn.functional.interpolate(
                  x, size=size, mode="nearest"
              )
  
      ops_9 = [
          {"op_name": "Shape"},
          {"op_name": "Constant"},
          {"op_name": "Gather"},
          {"op_name": "Shape"},
          {"op_name": "Constant"},
          {"op_name": "Gather"},
          {"op_name": "Constant"},
          {"op_name": "Mul"},
          {"op_name": "Constant"},
          {"op_name": "Mul"},
          {"op_name": "Unsqueeze"},
          {"op_name": "Unsqueeze"},
          {"op_name": "Concat"},
          {"op_name": "Cast"},
          {"op_name": "Shape"},
          {"op_name": "Slice"},
          {"op_name": "Cast"},
          {"op_name": "Div"},
          {"op_name": "Constant"},
          {"op_name": "Concat"},
          {
              "op_name": "Upsample",
              "attributes": [
                  {"name": "mode", "s": (b"nearest"), "type": 3}
              ],
          },
      ]
      ops_10 = [
          {"op_name": "Shape"},
          {"op_name": "Constant"},
          {"op_name": "Gather"},
          {"op_name": "Shape"},
          {"op_name": "Constant"},
          {"op_name": "Gather"},
          {"op_name": "Constant"},
          {"op_name": "Mul"},
          {"op_name": "Constant"},
          {"op_name": "Mul"},
          {"op_name": "Unsqueeze"},
          {"op_name": "Unsqueeze"},
          {"op_name": "Concat"},
          {"op_name": "Cast"},
          {"op_name": "Shape"},
          {"op_name": "Constant"},
          {"op_name": "Constant"},
          {"op_name": "Constant"},
          {"op_name": "Slice"},
          {"op_name": "Cast"},
          {"op_name": "Div"},
          {"op_name": "Constant"},
          {"op_name": "Concat"},
          {
              "op_name": "Resize",
              "attributes": [
                  {"name": "mode", "s": (b"nearest"), "type": 3}
              ],
          },
      ]
  
      ops = {9: ops_9, 10: ops_10}
      x = torch.randn(1, 2, 3, 4, requires_grad=True)
      check_onnx_opsets_operator(
          MyModel(),
          x,
          ops,
          opset_versions=[9, 10],
          input_names=["x"],
          dynamic_axes={"x": [0, 1, 2, 3]},
      )
  
      ops_9 = [
          {"op_name": "Constant"},
          {"op_name": "Shape"},
          {"op_name": "Slice"},
          {"op_name": "Cast"},
          {"op_name": "Div"},
          {"op_name": "Constant"},
          {"op_name": "Concat"},
          {
              "op_name": "Upsample",
              "attributes": [
                  {"name": "mode", "s": (b"nearest"), "type": 3}
              ],
          },
      ]
      ops_10 = [
          {"op_name": "Constant"},
          {"op_name": "Shape"},
          {"op_name": "Constant"},
          {"op_name": "Constant"},
          {"op_name": "Constant"},
          {"op_name": "Slice"},
          {"op_name": "Cast"},
          {"op_name": "Div"},
          {"op_name": "Constant"},
          {"op_name": "Concat"},
          {"op_name": "Resize"},
      ]
  
      ops = {9: ops_9, 10: ops_10}
      x = torch.randn(1, 2, 3, 4, requires_grad=True)
      check_onnx_opsets_operator(
          MyModel(), x, ops, opset_versions=[9, 10]
      )
  
      class MyDynamicModel(torch.nn.Module):
          def forward(self, x):
              size = [v * 2 for v in x.size()[2:]]
              # work around for now: turn the dynamic sizes into constant
              size = [int(i) for i in size]
              return torch.nn.functional.interpolate(
                  x, size=size, mode="nearest"
              )
  
      ops_9 = [
          {"op_name": "Constant"},
          {
              "op_name": "Upsample",
              "attributes": [
                  {"name": "mode", "s": (b"nearest"), "type": 3}
              ],
          },
      ]
      ops_10 = [
          {"op_name": "Constant"},
          {
              "op_name": "Resize",
              "attributes": [
                  {"name": "mode", "s": (b"nearest"), "type": 3}
              ],
          },
      ]
      ops = {9: ops_9, 10: ops_10}
      x = torch.randn(20, 16, 50)
      check_onnx_opsets_operator(
          MyDynamicModel(), x, ops, opset_versions=[9, 10]
      )
  
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 10 for calling the TestONNXOpset obj's underlying member method code with example usage: obj.test_interpolate() and returns: torch, torch