Skip to content

[tmva][sofie] Add new ScatterND operator#21621

Open
lmoneta wants to merge 1 commit intoroot-project:masterfrom
lmoneta:tmva_sofie_new_operator_devs
Open

[tmva][sofie] Add new ScatterND operator#21621
lmoneta wants to merge 1 commit intoroot-project:masterfrom
lmoneta:tmva_sofie_new_operator_devs

Conversation

@lmoneta
Copy link
Member

@lmoneta lmoneta commented Mar 16, 2026

Add implementation of ScatterND operator which is needed to parse MLPF model from CMS

Include also 3 tests to probe the different type of scattering wich can be performed by the operator

Add an implementation of ScatterND operator which is needed to parse the MLPF model from CMS

Include also 3 tests to probe the different type of scattering wich can be performed
@lmoneta lmoneta self-assigned this Mar 16, 2026
@lmoneta lmoneta requested a review from bellenot as a code owner March 16, 2026 16:09
@lmoneta lmoneta requested a review from sanjibansg March 16, 2026 16:09
Copy link
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I have also tested it with my AD refactoring PR, and it works well.

I have a few small suggestions though, and also one more general question: why not format new source file with clang-format? That would make the code more consistent in the long run, and also not confuse new contributors with the CI checks that are red when the code is not formatted.

Comment on lines +15 to +26
if (!parser.IsRegisteredTensorType(nodeproto.input(0))){
throw std::runtime_error("TMVA::SOFIE ONNX Parser ScatterND op has input tensor " + nodeproto.input(0)
+ " but its type is not yet registered");
}
if (!parser.IsRegisteredTensorType(nodeproto.input(1))){
throw std::runtime_error("TMVA::SOFIE ONNX Parser ScatterND op has input tensor " + nodeproto.input(1)
+ " but its type is not yet registered");
}
if (!parser.IsRegisteredTensorType(nodeproto.input(2))){
throw std::runtime_error("TMVA::SOFIE ONNX Parser ScatterND op has input tensor " + nodeproto.input(2)
+ " but its type is not yet registered");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that can also be done in a loop from zero to nodeproto.input_size().

Comment on lines +41 to +45
std::unique_ptr<ROperator> op;
std::string output_name = nodeproto.output(0);

op.reset(new ROperator_ScatterND(nodeproto.input(0), nodeproto.input(1), nodeproto.input(2),
output_name, reduction));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::unique_ptr<ROperator> op;
std::string output_name = nodeproto.output(0);
op.reset(new ROperator_ScatterND(nodeproto.input(0), nodeproto.input(1), nodeproto.input(2),
output_name, reduction));
auto op = std::make_unique<ROperator_ScatterND>(nodeproto.input(0), nodeproto.input(1), nodeproto.input(2),
nodeproto.output(0), reduction));

We can use C++17 now, and it's better to have no naked new or delete, because these can be a red flag.

Comment on lines +5 to +7
namespace TMVA {
namespace Experimental {
namespace SOFIE {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace TMVA {
namespace Experimental {
namespace SOFIE {
namespace TMVA::Experimental::SOFIE {

Personal preference maybe, but I think this is more readable.

Comment on lines +12 to +15
namespace TMVA{
namespace Experimental{
namespace SOFIE{

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace TMVA{
namespace Experimental{
namespace SOFIE{
namespace TMVA::Experimental::SOFIE {

Same here maybe.

@github-actions
Copy link

Test Results

    22 files      22 suites   3d 5h 3m 15s ⏱️
 3 810 tests  3 809 ✅ 1 💤 0 ❌
76 531 runs  76 522 ✅ 9 💤 0 ❌

Results for commit 6bf9819.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants