<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>
<p dir="auto">When I use torch.onnx.export , I met opset support problem:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py:562: UserWarning: ONNX export failed on ATen operator upsample_bilinear2d because torch.onnx.symbolic_opset9.upsample_bilinear2d does not exist
  .format(op_name, opset_version, op_name))
Traceback (most recent call last):
  File &quot;convertPytorch2ONNX.py&quot;, line 54, in &lt;module&gt;
    torch_out = torch.onnx.export(senetModel, input_var, sys.argv[4], export_params=True, verbose=True, input_names=input_names, output_names=output_names)
  File &quot;/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/__init__.py&quot;, line 132, in export
    strip_doc_string, dynamic_axes)
  File &quot;/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 64, in export
    example_outputs=example_outputs, strip_doc_string=strip_doc_string, dynamic_axes=dynamic_axes)
  File &quot;/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 329, in _export
    _retain_param_name, do_constant_folding)
  File &quot;/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 225, in _model_to_graph
    _disable_torch_constant_prop=_disable_torch_constant_prop)
  File &quot;/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 127, in _optimize_graph
    graph = torch._C._jit_pass_onnx(graph, operator_export_type)
  File &quot;/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/__init__.py&quot;, line 163, in _run_symbolic_function
    return utils._run_symbolic_function(*args, **kwargs)
  File &quot;/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 563, in _run_symbolic_function
    op_fn = sym_registry.get_registered_op(op_name, '', opset_version)
  File &quot;/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/symbolic_registry.py&quot;, line 91, in get_registered_op
    return _registry[(domain, version)][opname]
KeyError: 'upsample_bilinear2d'"><pre class="notranslate"><code class="notranslate">/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py:562: UserWarning: ONNX export failed on ATen operator upsample_bilinear2d because torch.onnx.symbolic_opset9.upsample_bilinear2d does not exist
  .format(op_name, opset_version, op_name))
Traceback (most recent call last):
  File "convertPytorch2ONNX.py", line 54, in &lt;module&gt;
    torch_out = torch.onnx.export(senetModel, input_var, sys.argv[4], export_params=True, verbose=True, input_names=input_names, output_names=output_names)
  File "/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/__init__.py", line 132, in export
    strip_doc_string, dynamic_axes)
  File "/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py", line 64, in export
    example_outputs=example_outputs, strip_doc_string=strip_doc_string, dynamic_axes=dynamic_axes)
  File "/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py", line 329, in _export
    _retain_param_name, do_constant_folding)
  File "/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py", line 225, in _model_to_graph
    _disable_torch_constant_prop=_disable_torch_constant_prop)
  File "/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py", line 127, in _optimize_graph
    graph = torch._C._jit_pass_onnx(graph, operator_export_type)
  File "/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/__init__.py", line 163, in _run_symbolic_function
    return utils._run_symbolic_function(*args, **kwargs)
  File "/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/utils.py", line 563, in _run_symbolic_function
    op_fn = sym_registry.get_registered_op(op_name, '', opset_version)
  File "/export/liuxiao/local/anaconda3/lib/python3.7/site-packages/torch/onnx/symbolic_registry.py", line 91, in get_registered_op
    return _registry[(domain, version)][opname]
KeyError: 'upsample_bilinear2d'
</code></pre></div>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior:</p>
<ol dir="auto">
<li>pytorch inference file</li>
<li>change the output to onnx.export</li>
</ol>
<h2 dir="auto">Environment</h2>
<ul dir="auto">
<li>PyTorch Version (e.g., 1.0): 1.2</li>
<li>OS (e.g., Linux): Centos</li>
<li>How you installed PyTorch (<code class="notranslate">conda</code>, <code class="notranslate">pip</code>, source): Conda</li>
<li>Build command you used (if compiling from source):</li>
<li>Python version: 3.7.3</li>
<li>CUDA/cuDNN version: 10/7.6</li>
<li>Any other relevant information: pytorch model is trained by pytorch 1.0.0</li>
</ul>
<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>
<p dir="auto">This issue is related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="440234928" data-permission-text="Title is private" data-url="https://github.com/pytorch/pytorch/issues/20116" data-hovercard-type="pull_request" data-hovercard-url="/pytorch/pytorch/pull/20116/hovercard" href="https://github.com/pytorch/pytorch/pull/20116">#20116</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="354684995" data-permission-text="Title is private" data-url="https://github.com/pytorch/pytorch/issues/10942" data-hovercard-type="issue" data-hovercard-url="/pytorch/pytorch/issues/10942/hovercard" href="https://github.com/pytorch/pytorch/issues/10942">#10942</a> and has to deal with <code class="notranslate">upsample_bilinear2d</code></p>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior:</p>
<ol dir="auto">
<li>This snippet can be used to reproduce behavior</li>
</ol>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import torch
import torch.nn as nn
import torch.nn.functional as F

class TestModel(nn.Module):
    def __init__(self):
        super(TestModel, self).__init__()

    def forward(self, x):
        x = F.interpolate(x, scale_factor=2, mode='bilinear', align_corners=False)
        return x

torch_model = TestModel()
dummy_input = torch.randn(1, 3, 256, 256)

torch_out = torch.onnx.export(torch_model, dummy_input, 'test_model.onnx', verbose=True)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">torch</span>
<span class="pl-k">import</span> <span class="pl-s1">torch</span>.<span class="pl-s1">nn</span> <span class="pl-k">as</span> <span class="pl-s1">nn</span>
<span class="pl-k">import</span> <span class="pl-s1">torch</span>.<span class="pl-s1">nn</span>.<span class="pl-s1">functional</span> <span class="pl-k">as</span> <span class="pl-v">F</span>

<span class="pl-k">class</span> <span class="pl-v">TestModel</span>(<span class="pl-s1">nn</span>.<span class="pl-v">Module</span>):
    <span class="pl-k">def</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>):
        <span class="pl-en">super</span>(<span class="pl-v">TestModel</span>, <span class="pl-s1">self</span>).<span class="pl-en">__init__</span>()

    <span class="pl-k">def</span> <span class="pl-en">forward</span>(<span class="pl-s1">self</span>, <span class="pl-s1">x</span>):
        <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-v">F</span>.<span class="pl-en">interpolate</span>(<span class="pl-s1">x</span>, <span class="pl-s1">scale_factor</span><span class="pl-c1">=</span><span class="pl-c1">2</span>, <span class="pl-s1">mode</span><span class="pl-c1">=</span><span class="pl-s">'bilinear'</span>, <span class="pl-s1">align_corners</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)
        <span class="pl-k">return</span> <span class="pl-s1">x</span>

<span class="pl-s1">torch_model</span> <span class="pl-c1">=</span> <span class="pl-v">TestModel</span>()
<span class="pl-s1">dummy_input</span> <span class="pl-c1">=</span> <span class="pl-s1">torch</span>.<span class="pl-en">randn</span>(<span class="pl-c1">1</span>, <span class="pl-c1">3</span>, <span class="pl-c1">256</span>, <span class="pl-c1">256</span>)

<span class="pl-s1">torch_out</span> <span class="pl-c1">=</span> <span class="pl-s1">torch</span>.<span class="pl-s1">onnx</span>.<span class="pl-en">export</span>(<span class="pl-s1">torch_model</span>, <span class="pl-s1">dummy_input</span>, <span class="pl-s">'test_model.onnx'</span>, <span class="pl-s1">verbose</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)</pre></div>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">That snippet is working under <code class="notranslate">torch.__version__</code> : <code class="notranslate">1.0.1.post2</code>, installed in a conda env, it seems that there it's able to parse to onnx since the output is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="graph(%input : Float(1, 3, 256, 256)) {
  %1 : Tensor = onnx::Constant[value= 1  1  2  2 [ CPUFloatType{4} ]](), scope: TestModel
  %2 : Float(1, 3, 512, 512) = onnx::Upsample[mode=&quot;linear&quot;](%input, %1), scope: TestModel
  return (%2);
}
"><pre class="notranslate"><code class="notranslate">graph(%input : Float(1, 3, 256, 256)) {
  %1 : Tensor = onnx::Constant[value= 1  1  2  2 [ CPUFloatType{4} ]](), scope: TestModel
  %2 : Float(1, 3, 512, 512) = onnx::Upsample[mode="linear"](%input, %1), scope: TestModel
  return (%2);
}

</code></pre></div>
<p dir="auto">Under <code class="notranslate">torch.__version__</code> : <code class="notranslate">1.1.0</code> the error would be this one:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;test.py&quot;, line 16, in &lt;module&gt;
    torch_out = torch.onnx.export(torch_model, dummy_input, 'test_model.onnx', verbose=True)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/__init__.py&quot;, line 25, in export
    return utils.export(*args, **kwargs)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 131, in export
    strip_doc_string=strip_doc_string)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 363, in _export
    _retain_param_name, do_constant_folding)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 278, in _model_to_graph
    _disable_torch_constant_prop=_disable_torch_constant_prop)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 188, in _optimize_graph
    graph = torch._C._jit_pass_onnx(graph, operator_export_type)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/__init__.py&quot;, line 50, in _run_symbolic_function
    return utils._run_symbolic_function(*args, **kwargs)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 589, in _run_symbolic_function
    return fn(g, *inputs, **attrs)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/symbolic.py&quot;, line 130, in wrapper
    args = [_parse_arg(arg, arg_desc) for arg, arg_desc in zip(args, arg_descriptors)]
  File &quot;/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/symbolic.py&quot;, line 130, in &lt;listcomp&gt;
    args = [_parse_arg(arg, arg_desc) for arg, arg_desc in zip(args, arg_descriptors)]
  File &quot;/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/symbolic.py&quot;, line 90, in _parse_arg
    raise RuntimeError(&quot;Failed to export an ONNX attribute, &quot;
RuntimeError: Failed to export an ONNX attribute, since it's not constant, please try to make things (e.g., kernel size) static if possible
"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "test.py", line 16, in &lt;module&gt;
    torch_out = torch.onnx.export(torch_model, dummy_input, 'test_model.onnx', verbose=True)
  File "/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/__init__.py", line 25, in export
    return utils.export(*args, **kwargs)
  File "/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/utils.py", line 131, in export
    strip_doc_string=strip_doc_string)
  File "/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/utils.py", line 363, in _export
    _retain_param_name, do_constant_folding)
  File "/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/utils.py", line 278, in _model_to_graph
    _disable_torch_constant_prop=_disable_torch_constant_prop)
  File "/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/utils.py", line 188, in _optimize_graph
    graph = torch._C._jit_pass_onnx(graph, operator_export_type)
  File "/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/__init__.py", line 50, in _run_symbolic_function
    return utils._run_symbolic_function(*args, **kwargs)
  File "/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/utils.py", line 589, in _run_symbolic_function
    return fn(g, *inputs, **attrs)
  File "/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/symbolic.py", line 130, in wrapper
    args = [_parse_arg(arg, arg_desc) for arg, arg_desc in zip(args, arg_descriptors)]
  File "/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/symbolic.py", line 130, in &lt;listcomp&gt;
    args = [_parse_arg(arg, arg_desc) for arg, arg_desc in zip(args, arg_descriptors)]
  File "/home/bpinaya/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/onnx/symbolic.py", line 90, in _parse_arg
    raise RuntimeError("Failed to export an ONNX attribute, "
RuntimeError: Failed to export an ONNX attribute, since it's not constant, please try to make things (e.g., kernel size) static if possible

</code></pre></div>
<p dir="auto">And in a fresh conda env with pytoch installed from master with commit <code class="notranslate">3b1c3996e1c82ca8f43af9efa196b33e36efee37</code> and <code class="notranslate">torch.__version__</code> : <code class="notranslate">1.2.0a0+3b1c399</code> the error for the upsample_bilinear2d is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py:662: UserWarning: ONNX export failed on ATen operator upsample_bilinear2d because torch.onnx.symbolic_opset9.upsample_bil
inear2d does not exist
  .format(op_name, opset_version, op_name))
Traceback (most recent call last):
  File &quot;convert_to_onnx.py&quot;, line 36, in &lt;module&gt;
    output_names=output_layer_names))
  File &quot;/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/__init__.py&quot;, line 32, in export
    return utils.export(*args, **kwargs)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 170, in export
    example_outputs=example_outputs, strip_doc_string=strip_doc_string, dynamic_axes=dynamic_axes)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 429, in _export
    _retain_param_name, do_constant_folding)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 330, in _model_to_graph
    _disable_torch_constant_prop=_disable_torch_constant_prop)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 232, in _optimize_graph
    graph = torch._C._jit_pass_onnx(graph, operator_export_type)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/__init__.py&quot;, line 57, in _run_symbolic_function
    return utils._run_symbolic_function(*args, **kwargs)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py&quot;, line 663, in _run_symbolic_function
    op_fn = sym_registry.get_registered_op(op_name, '', opset_version)
  File &quot;/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/symbolic_registry.py&quot;, line 91, in get_registered_op
    return _registry[(domain, version)][opname]
KeyError: 'upsample_bilinear2d'"><pre class="notranslate"><code class="notranslate">/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py:662: UserWarning: ONNX export failed on ATen operator upsample_bilinear2d because torch.onnx.symbolic_opset9.upsample_bil
inear2d does not exist
  .format(op_name, opset_version, op_name))
Traceback (most recent call last):
  File "convert_to_onnx.py", line 36, in &lt;module&gt;
    output_names=output_layer_names))
  File "/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/__init__.py", line 32, in export
    return utils.export(*args, **kwargs)
  File "/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py", line 170, in export
    example_outputs=example_outputs, strip_doc_string=strip_doc_string, dynamic_axes=dynamic_axes)
  File "/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py", line 429, in _export
    _retain_param_name, do_constant_folding)
  File "/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py", line 330, in _model_to_graph
    _disable_torch_constant_prop=_disable_torch_constant_prop)
  File "/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py", line 232, in _optimize_graph
    graph = torch._C._jit_pass_onnx(graph, operator_export_type)
  File "/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/__init__.py", line 57, in _run_symbolic_function
    return utils._run_symbolic_function(*args, **kwargs)
  File "/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/utils.py", line 663, in _run_symbolic_function
    op_fn = sym_registry.get_registered_op(op_name, '', opset_version)
  File "/home/bpinaya/anaconda3/envs/pytorch-edge/lib/python3.7/site-packages/torch/onnx/symbolic_registry.py", line 91, in get_registered_op
    return _registry[(domain, version)][opname]
KeyError: 'upsample_bilinear2d'
</code></pre></div>
<p dir="auto">And according to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="440234928" data-permission-text="Title is private" data-url="https://github.com/pytorch/pytorch/issues/20116" data-hovercard-type="pull_request" data-hovercard-url="/pytorch/pytorch/pull/20116/hovercard" href="https://github.com/pytorch/pytorch/pull/20116">#20116</a> the error should be fixed on master</p>
<h2 dir="auto">Environment</h2>
<p dir="auto">The output of <code class="notranslate">collect_env</code>:<br>
Collecting environment information...<br>
PyTorch version: 1.1.0<br>
Is debug build: No<br>
CUDA used to build PyTorch: 10.0.130</p>
<p dir="auto">OS: Ubuntu 18.04.2 LTS<br>
GCC version: (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0<br>
CMake version: version 3.10.2</p>
<p dir="auto">Python version: 3.7<br>
Is CUDA available: Yes<br>
CUDA runtime version: 10.0.130<br>
GPU models and configuration:<br>
GPU 0: GeForce GTX 1080 Ti<br>
GPU 1: GeForce GTX 1080 Ti</p>
<p dir="auto">Nvidia driver version: 418.56<br>
cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.5.0</p>
<p dir="auto">Versions of relevant libraries:<br>
[pip] numpy==1.16.2<br>
[pip] numpydoc==0.8.0<br>
[pip] torch==1.1.0<br>
[pip] torchvision==0.3.0<br>
[conda] blas                      1.0                         mkl<br>
[conda] mkl                       2019.3                      199<br>
[conda] mkl-service               1.1.2            py37he904b0f_5<br>
[conda] mkl_fft                   1.0.10           py37ha843d7b_0<br>
[conda] mkl_random                1.0.2            py37hd81dba3_0<br>
[conda] pytorch                   1.1.0           py3.7_cuda10.0.130_cudnn7.5.1_0    pytorch<br>
[conda] torchvision               0.3.0           py37_cu10.0.130_1    pytorch</p>
<p dir="auto">Bear in mind that I tried on pytorch 1.0.1, 1.1.0 and master.</p>
<h2 dir="auto">Additional context</h2>
<p dir="auto">If I were to use something like:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import torch
import torch.nn as nn
import torch.nn.functional as F

class TestModel(nn.Module):
    def __init__(self):
        super(TestModel, self).__init__()

    def forward(self, x):
        x = F.interpolate(x, x.size()[2:], mode='bilinear', align_corners=False)
        return x

torch_model = TestModel()
dummy_input = torch.randn(1, 3, 256, 256)

torch_out = torch.onnx.export(torch_model, dummy_input, 'test_model.onnx', verbose=True)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">torch</span>
<span class="pl-k">import</span> <span class="pl-s1">torch</span>.<span class="pl-s1">nn</span> <span class="pl-k">as</span> <span class="pl-s1">nn</span>
<span class="pl-k">import</span> <span class="pl-s1">torch</span>.<span class="pl-s1">nn</span>.<span class="pl-s1">functional</span> <span class="pl-k">as</span> <span class="pl-v">F</span>

<span class="pl-k">class</span> <span class="pl-v">TestModel</span>(<span class="pl-s1">nn</span>.<span class="pl-v">Module</span>):
    <span class="pl-k">def</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>):
        <span class="pl-en">super</span>(<span class="pl-v">TestModel</span>, <span class="pl-s1">self</span>).<span class="pl-en">__init__</span>()

    <span class="pl-k">def</span> <span class="pl-en">forward</span>(<span class="pl-s1">self</span>, <span class="pl-s1">x</span>):
        <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-v">F</span>.<span class="pl-en">interpolate</span>(<span class="pl-s1">x</span>, <span class="pl-s1">x</span>.<span class="pl-en">size</span>()[<span class="pl-c1">2</span>:], <span class="pl-s1">mode</span><span class="pl-c1">=</span><span class="pl-s">'bilinear'</span>, <span class="pl-s1">align_corners</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)
        <span class="pl-k">return</span> <span class="pl-s1">x</span>

<span class="pl-s1">torch_model</span> <span class="pl-c1">=</span> <span class="pl-v">TestModel</span>()
<span class="pl-s1">dummy_input</span> <span class="pl-c1">=</span> <span class="pl-s1">torch</span>.<span class="pl-en">randn</span>(<span class="pl-c1">1</span>, <span class="pl-c1">3</span>, <span class="pl-c1">256</span>, <span class="pl-c1">256</span>)

<span class="pl-s1">torch_out</span> <span class="pl-c1">=</span> <span class="pl-s1">torch</span>.<span class="pl-s1">onnx</span>.<span class="pl-en">export</span>(<span class="pl-s1">torch_model</span>, <span class="pl-s1">dummy_input</span>, <span class="pl-s">'test_model.onnx'</span>, <span class="pl-s1">verbose</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)</pre></div>
<p dir="auto">without manually specifying the sizes, the issue still remains and now also appears on version 1.0.1 of course.<br>
Any insights are appreciated, thanks for the hard work guys!</p>