[tmva][sofie] Selu ignores its alpha and gamma attributes
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Check duplicate issues.
- Checked for duplicates
Description
ParseSelu never reads the alpha and gamma attributes of the ONNX Selu operator, and ROperator_Selu::Generate() hard-codes their default values (1.6732632423543772848170429916717 and 1.0507009873554804934193349852946). A Selu node with other values silently gives wrong results. The other activations with attributes (Elu, LeakyRelu, HardSigmoid, Gelu) read them.
Expected: y = gamma * x for x > 0 and y = gamma * alpha * (exp(x) - 1) otherwise, with the values of the node.
Reproducer
import os
import numpy as np
import onnx
import onnxruntime as ort
import ROOT
from onnx import TensorProto, helper
os.chdir(os.path.dirname(os.path.abspath(__file__)))
node = helper.make_node("Selu", ["x"], ["y"], alpha=2.0, gamma=3.0)
graph = helper.make_graph(
[node],
"selu_attributes",
[helper.make_tensor_value_info("x", TensorProto.FLOAT, [1, 4])],
[helper.make_tensor_value_info("y", TensorProto.FLOAT, [1, 4])],
)
model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 13)], ir_version=8)
onnx.save(model, "selu_attributes.onnx")
x = np.array([[-2.0, -0.5, 0.5, 2.0]], np.float32)
print("onnxruntime:", ort.InferenceSession("selu_attributes.onnx").run(None, {"x": x})[0].tolist())
ROOT.gInterpreter.Declare("""
#include "TMVA/RModelParser_ONNX.hxx"
void selu_generate() {
using namespace TMVA::Experimental::SOFIE;
RModelParser_ONNX parser;
RModel model = parser.Parse("selu_attributes.onnx");
model.Generate();
model.OutputGenerated("selu_attributes.hxx");
}
""")
ROOT.selu_generate()
ROOT.gInterpreter.Declare('#include "selu_attributes.hxx"')
session = ROOT.TMVA_SOFIE_selu_attributes.Session()
print("SOFIE: ", [round(v, 6) for v in session.infer(x.ravel())])
Output:
onnxruntime: [[-5.18798828125, -2.36081600189209, 1.5, 6.0]]
SOFIE: [-1.520167, -0.691758, 0.525351, 2.101402]
ROOT version
6.41.01, master at c619e8fbd7f
Installation method
Built from source (CMake, Release, -Dtesting=ON)
Operating system
macOS 26 (arm64, Apple M4 Pro)
Additional context
I found this with a script that runs the ONNX operator tests from the onnx Python package through SOFIE (test_selu and test_selu_example give wrong values)
the script was written by Claude .
I'll open a PR with a fix and a test.
- Ngôn ngữ chính
- C++
- Star
- 3.3k
- Fork
- 1.6k
- Merge trung bình
- 2 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 197
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của root-project/root
-
thisroot.sh: wrong ROOTSYS in zsh when the shell's command line has a newlineCó thể đã có người làm @dpiparo đã nhận 1 ngày trước. Đang mởbug in:Build System
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
root-project/root#23746 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[tmva][sofie] Inputs of unsupported type (e.g. float16) give code that does not compile instead of an errorCó thể đã có người làm @lmoneta đã nhận 11 ngày trước. Đang mởAI-Assisted bug in:SOFIE
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
root-project/root#23655 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`TChain::GetEntries` internal caching ineffective?Có thể đã có người làm @pcanal đã nhận 4 ngày trước. Đang mởimprovement in:TTree
root-project/root#23738 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[PyROOT] Segfault at exit deleting a branch with a Cling-generated collection destructor after cppyy instantiated a templateCó thể đã có người làm @guitargeek đã nhận 4 ngày trước. Đang mởbug in:Python Interface
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
root-project/root#23728 · 8 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Potential problems on Windows due to conflicting CRT librariesCó thể đã có người làm @bellenot đã nhận 6 ngày trước. Đang mởimprovement in:Core Libraries
root-project/root#23713 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của root-project/root
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ROCm/rocm-libraries#14027 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Qiskit/qiskit-aer#2487 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
GUI
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
qbittorrent/qBittorrent#25104 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
P2: A timed rotation maneuver does nothing on a ship that had an earlier timed lateral maneuverĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
scp-fs2open/fs2open.github.com#7914 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày