[tmva][sofie] Selu ignores its alpha and gamma attributes
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
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.
- 主要言語
- C++
- スター
- 3.3k
- フォーク
- 1.6k
- 平均マージ
- 2日 10時間
- マージ済み PR(30日)
- 197
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
root-project/root のほかの issue
-
thisroot.sh: wrong ROOTSYS in zsh when the shell's command line has a newline対応中かも @dpiparo が 1 日前に担当しました。 オープンbug in:Build System
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
root-project/root#23746 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[tmva][sofie] Inputs of unsupported type (e.g. float16) give code that does not compile instead of an error対応中かも @lmoneta が 11 日前に担当しました。 オープンAI-Assisted bug in:SOFIE
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
root-project/root#23655 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
`TChain::GetEntries` internal caching ineffective?対応中かも @pcanal が 4 日前に担当しました。 オープンimprovement in:TTree
root-project/root#23738 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[PyROOT] Segfault at exit deleting a branch with a Cling-generated collection destructor after cppyy instantiated a template対応中かも @guitargeek が 4 日前に担当しました。 オープンbug in:Python Interface
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
root-project/root#23728 · コメント 8 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Potential problems on Windows due to conflicting CRT libraries対応中かも @bellenot が 6 日前に担当しました。 オープンimprovement in:Core Libraries
root-project/root#23713 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
root-project/root の issue をすべて見る
似ている issue
-
P2: A timed rotation maneuver does nothing on a ship that had an earlier timed lateral maneuverオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
scp-fs2open/fs2open.github.com#7914 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
eclipse-score/inc_someip_gateway#356 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
HarperFast/rocksdb-js#945 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信