Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using onnxruntime v1.14.1, all output values of Sigmoid are Nan. #14885

Closed
PINTO0309 opened this issue Mar 2, 2023 · 1 comment
Closed
Labels
regression issues that demonstrate a regression in ORT functionality and need to be addressed immediately

Comments

@PINTO0309
Copy link

PINTO0309 commented Mar 2, 2023

Describe the issue

When using onnxruntime v1.14.1, all output values of Sigmoid are Nan. However, if the Sigmoid is in the last layer, it works correctly, and if it is before the last layer, it becomes Nan.

It is inferred correctly in onnxruntime v1.13.1.

To reproduce

  • onnx file with Sigmoid one before the last layer
    test_cut.onnx.zip
    image
    • test code
      import numpy as np
      import onnxruntime as ort
      
      onnx_session = ort.InferenceSession(
          'test_cut.onnx',
          providers=[
              'CPUExecutionProvider'
          ],
      )
      
      model_input = onnx_session.get_inputs()[0]
      model_outputs = [output.name for output in onnx_session.get_outputs()]
      input_name = model_input.name
      input_shape = model_input.shape
      result = onnx_session.run(
          output_names=model_outputs,
          input_feed={input_name: np.ones([1], dtype=np.float32)},
      )
      for idx, (ret, name) in enumerate(zip(result, model_outputs)):
          print(f'{idx}. {name}, value:{ret}' if ret is None else f'{idx}. {name}, shape:{ret.shape}')
    • results
      0. /Unsqueeze_output_0, shape:(1, 1)
      1. /Mul_output_0, shape:(1, 64)
      2. /Sin_output_0, shape:(1, 64)
      3. /Cos_output_0, shape:(1, 64)
      4. /Concat_output_0, shape:(1, 128)
      5. /dense.0/Gemm_output_0, shape:(1, 512)
      6. /Sigmoid_output_0, value:None <-------------------------------- here
      7. /Mul_1_output_0, shape:(1, 512)
      
  • onnx file with Sigmoid in the last layer
    test_cut_sigm.onnx.zip
    image
    • test code
      import numpy as np
      import onnxruntime as ort
      
      onnx_session = ort.InferenceSession(
          'test_cut_sigm.onnx',
          providers=[
              'CPUExecutionProvider'
          ],
      )
      
      model_input = onnx_session.get_inputs()[0]
      model_outputs = [output.name for output in onnx_session.get_outputs()]
      input_name = model_input.name
      input_shape = model_input.shape
      result = onnx_session.run(
          output_names=model_outputs,
          input_feed={input_name: np.ones([1], dtype=np.float32)},
      )
      for idx, (ret, name) in enumerate(zip(result, model_outputs)):
          print(f'{idx}. {name}, value:{ret}' if ret is None else f'{idx}. {name}, shape:{ret.shape}')
      
    • results
      0. /Unsqueeze_output_0, shape:(1, 1)
      1. /Mul_output_0, shape:(1, 64)
      2. /Sin_output_0, shape:(1, 64)
      3. /Cos_output_0, shape:(1, 64)
      4. /Concat_output_0, shape:(1, 128)
      5. /dense.0/Gemm_output_0, shape:(1, 512)
      6. /Sigmoid_output_0, shape:(1, 512)
      

Urgency

There is a regression in ONNX Runtime functionality.

Platform

Linux

OS Version

Ubuntu 20.04

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

v1.14.1

ONNX Runtime API

Python

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

@PINTO0309 PINTO0309 changed the title When using onnxruntime v1.14.0, all output values of sigmoid are Nan. When using onnxruntime v1.14.0, all output values of Sigmoid are Nan. Mar 2, 2023
@PINTO0309 PINTO0309 changed the title When using onnxruntime v1.14.0, all output values of Sigmoid are Nan. When using onnxruntime v1.14.1, all output values of Sigmoid are Nan. Mar 2, 2023
@fs-eire fs-eire added the regression issues that demonstrate a regression in ORT functionality and need to be addressed immediately label Mar 3, 2023
@PINTO0309
Copy link
Author

This critical problem was resolved in onnxruntime v1.15.0. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression issues that demonstrate a regression in ORT functionality and need to be addressed immediately
Projects
None yet
Development

No branches or pull requests

2 participants