Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[tmva][sofie] Selu ignores its alpha and gamma attributes

オープン
#23,734 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@lmoneta がすでに取り組んでいます。

2026年10月16日 から。

  • #23743 @Maher-star-eng による — オープン

評価

この issue はまだ評価されていません。

説明

bug in:SOFIE
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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

root-project/root のほかの issue

root-project/root の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。