microsoft / microsoft/onnxruntime
Runtime Exception when relu is followed by a clip
Open
@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

- Error message
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.