microsoft / microsoft/onnxruntime

[Feature Request] using SetSeed on C++ inference

Open
#23,306 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 8h
Merged PRs (30d)
179

Description

Describe the feature request

Will a future update be able to fix the random number seed during inference as well?

Describe scenario use case

Hi, I am making a C++ program for inference with a neural network model.
The neural network model includes a module that generates random numbers (RandomNormalLike).
Therefore, the output values are slightly different even for the same input.

I want to implement a function that turns this randomness on and off.
Example: We would like to store and use the seed of an excellent result.
Looking at the API reference, it seems that the SetSeed() function can be used to fix the random number seed during training (onnxruntime_training_c_api.h), but it is not available during inference (onnxruntime_cxx_api.h).
https://onnxruntime.ai/docs/api/c/namespace_ort.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the existing SetSeed() API in onnxruntime_training_c_api.h with the inference interface in onnxruntime_cxx_api.h, using the linked API reference as context. Determine the intended way to control RandomNormalLike randomness during C++ inference, including how enabling and disabling fixed seeds should behave. Done means the inference API supports the requested seed control with documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.