Skip to content

Wrong result with If node #3900

@nomaddo

Description

@nomaddo

Describe the bug
Wrong result is produce with the following ONNX.
https://gist.github.com/nomaddo/965614ac0684e1042850f6d84cc38970

See how to create
See how to run

This ONNX graph has one if node with very simple sub-graphs (having one Constant node).
The sub-graphs never return 0., but got wrong result as follows:

$ python3 run.py model.onnx 
[array([[[[0.]]]], dtype=float32)]

Urgency
None

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Debian GNU/Linux 10 (buster)
  • ONNX Runtime installed from (source or binary): binary (via pip)
  • ONNX Runtime version: 1.2.0
  • Python version: 3.7.3
  • Visual Studio version (if applicable):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

To Reproduce

  • Describe steps/code to reproduce the behavior.
$ sudo docker run -it --rm debian:buster /bin/bash
$ apt update; apt install -y ssh git python3 python3-pip
$ git clone https://gist.github.com/965614ac0684e1042850f6d84cc38970.git bug_report
$ cd bug_report
$ pip3 install onnx onnxruntime
$ pip3 list
Package           Version
----------------- -------
asn1crypto        0.24.0 
cryptography      2.6.1  
entrypoints       0.3    
keyring           17.1.1 
keyrings.alt      3.1.1  
numpy             1.18.4 
onnx              1.7.0  
onnxruntime       1.2.0  
pip               18.1   
protobuf          3.11.3 
pycrypto          2.6.1  
PyGObject         3.30.4 
pyxdg             0.25   
SecretStorage     2.3.1  
setuptools        40.8.0 
six               1.12.0 
typing-extensions 3.7.4.2
wheel             0.32.3 
$ python3 gen_onnx.py  # create model.onnx
$ python3 run.py model.onnx 
[array([[[[0.]]]], dtype=float32)]

Expected behavior
Got the following result:

$ python3 run.py model.onnx 
[array([[[[1001.]]]], dtype=float32)]

Screenshots
None

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions