[tmva][sofie] Inputs of unsupported type (e.g. float16) give code that does not compile instead of an error
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 65/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
调研方向
有问题的检查是 tmva/sofie/src/RModel.cxx 中 RModel::GenerateInferSignature 里与 "other" 的比较(约第 1202-1205 行)。tmva/sofie/src/SOFIE_common.cxx 中的 ConvertTypeToString(约第 102 行)对未知类型返回 "other_" + type,因此先比较这两处。运行 Python 复现脚本,检查对于 FLOAT16 输入,Generate() 是否抛出已有的“尚不支持”错误。应在 TestSofieParser.cxx 中添加解析器测试来覆盖该情况。
由索引模型根据 Issue 内容生成。
描述
Check duplicate issues.
- Checked for duplicates
Description
When a model input has a type that SOFIE does not support, RModel::Generate() is supposed to throw "input tensor ... is of a data type which is not yet supported." (RModel::GenerateInferSignature, tmva/sofie/src/RModel.cxx, lines 1202-1205). That check never fires: it compares the type name with "other", but ConvertTypeToString returns "other_" + std::to_string(type) for the types it does not know (tmva/sofie/src/SOFIE_common.cxx, line 102), e.g. "other_10" for FLOAT16.
So Generate() succeeds and writes a header with other_10 const* tensor_x in the signatures of infer() and doInfer(), and the user only gets an unknown type name 'other_10' compile error later. This affects every type that ConvertTypeToString does not handle (FLOAT16, BFLOAT16, STRING, COMPLEX64/128). Operators such as Relu or Identity reject such inputs themselves, but Shape and Cast let them through.
Expected: Generate() throws the existing "not yet supported" error.
Reproducer
import os
import re
import ROOT
from onnx import TensorProto, helper, save
os.chdir(os.path.dirname(os.path.abspath(__file__)))
node = helper.make_node("Shape", ["x"], ["y"])
graph = helper.make_graph(
[node],
"float16_input",
[helper.make_tensor_value_info("x", TensorProto.FLOAT16, [2, 3])],
[helper.make_tensor_value_info("y", TensorProto.INT64, [2])],
)
model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 13)], ir_version=8)
save(model, "float16_input.onnx")
ROOT.gInterpreter.Declare("""
#include "TMVA/RModelParser_ONNX.hxx"
std::string float16_generate() {
using namespace TMVA::Experimental::SOFIE;
try {
RModelParser_ONNX parser;
RModel model = parser.Parse("float16_input.onnx");
model.Generate();
model.OutputGenerated("float16_input.hxx");
} catch (const std::exception &e) {
return e.what();
}
return "no exception";
}
""")
print("Generate():", ROOT.float16_generate())
print("infer signature:", re.search(r"infer\((.*)\)", open("float16_input.hxx").read()).group(1))
print("compiles:", ROOT.gInterpreter.Declare('#include "float16_input.hxx"'))
Output (compiler errors shortened):
./float16_input.hxx:77:28: error: unknown type name 'other_10'
std::vector<int64_t> infer(other_10 const* tensor_x){
Generate(): no exception
infer signature: other_10 const* tensor_x
compiles: False
ROOT version
6.41.01, master at c619e8fbd7f (the code is unchanged in the current master)
Installation method
Built from source (CMake, Release, -Dtesting=ON)
Operating system
macOS 26 (arm64, Apple M4 Pro)
Additional context
I found this while running the ONNX operator tests (from the onnx Python package) through SOFIE. I used AI assistance (Claude) to investigate it I ran the reproducer and checked its output myself. I'll open a PR with a fix and a test in TestSofieParser.cxx.
- 主要语言
- C++
- 星标
- 3.3k
- 派生
- 1.6k
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 188
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
root-project/root 的其他 Issue
-
thisroot.sh: wrong ROOTSYS in zsh when the shell's command line has a newline可能已有人在做 @dpiparo 于 4 天前认领。 未关闭bug in:Build System
难度 2/5 1-3 小时 新手友好度 86/100
root-project/root#23746 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[RDataFrame] Code that transforms `#var` alias to `R_rdf_sizeof_var` does not respect string literals可能已有人在做 @vepadulano 于 1 天前认领。 未关闭bug in:RDataFrame
难度 3/5 1-2 天 新手友好度 71/100
root-project/root#23790 · 已指派 1 人 ·
维护者通常 1 天内回复
-
TDataMember::GetOffset interfers to TDataMember::GetOffsetCint可能已有人在做 @pcanal 于 1 天前认领。 未关闭bug in:Core Libraries
难度 4/5 3-5 天 新手友好度 48/100
root-project/root#23777 · 已指派 1 人 ·
维护者通常 1 天内回复
-
`TChain::GetEntries` internal caching ineffective?可能已有人在做 @pcanal 于 7 天前认领。 未关闭improvement in:TTree
root-project/root#23738 · 6 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[PyROOT] Segfault at exit deleting a branch with a Cling-generated collection destructor after cppyy instantiated a template可能已有人在做 @guitargeek 于 7 天前认领。 未关闭bug in:Python Interface test wit cppjit
难度 5/5 一周以上 新手友好度 12/100
root-project/root#23728 · 9 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 root-project/root 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
bulletphysics/bullet3#4819 ·
-
[YSQL] Local-node initdb reads postgres.bki, but YB clusters bootstrap only from yb_postgres.bki未关闭area/ysql kind/enhancement priority/low status/awaiting-triage
难度 2/5 1-3 小时 新手友好度 72/100
yugabyte/yugabyte-db#35763 ·
维护者通常 1 天内回复
-
category:port-update
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
facebookresearch/faiss#5775 · 1 条评论 ·
维护者通常 2 天内回复
-
Eval bug: minimax-m3: build_moe_ffn() drops the per-expert NVFP4 scale → garbled output (M3.1 Flash)未关闭bug-unconfirmed
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复