microsoft / microsoft/onnxruntime

Runtime Exception when relu is followed by a clip

Open
#10,936 2 comments 0 reactions 1 assignee View on GitHub

@snnn is already working on this.

Since Mar 18, 2022.

core runtime
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 8h
Merged PRs (30d)
179

Description

@hariharans29
Describe the bug
Similar to #9753, on opset version 14, when relu is followed by a clip clip(relu(i1),-1,1), and input i1 is torch.float64 data type, ORT raises a RuntimeException Error.

Urgency
None.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS Mojave
  • ONNX Runtime installed from (source or binary): Binary
  • ONNX Runtime version: 1.10.0
  • Python version: 3.9.7
  • Visual Studio version (if applicable): n/a
  • GCC/Compiler version (if compiling from source): n/a
  • CUDA/cuDNN version: n/a
  • GPU model and memory: n/a
  • PyTorch version: 1.10.2

To Reproduce

  • Describe steps/code to reproduce the behavior.
import torch
import onnx.checker
import onnxruntime as ort
class Model(torch.nn.Module):
    @torch.no_grad()
    def forward(self, i1):
        x=torch.relu(i1)
        o0=torch.clip(x,-1,1)
        return o0


model = Model()
inputs = (torch.randn((2, 2, 2, 1, 2),dtype=torch.float64),)
output_names = ["o0"]
torch.onnx.export(model, inputs, "1.onnx", verbose=False,
                  input_names=["i1"], output_names=output_names, opset_version=14)

onnx_model = onnx.load("1.onnx")
onnx.checker.check_model(onnx_model,full_check=True)
sess = ort.InferenceSession(
     onnx._serialize(onnx_model))
res = sess.run(output_names, {"input": inputs[0].numpy()})
  • Attach the ONNX model to the issue (where applicable) to expedite investigation.
    1.onnx.zip

Expected behavior
Not crash.

Screenshots
屏幕快照 2022-03-17 下午11 32 33

  • Error message
屏幕快照 2022-03-18 上午12 12 01

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.