28 OrtAllocatorType allocatorType,
29 OrtMemType memoryType,
30 int64_t batchSize) : mModelPath(modelPath), mSession(nullptr), mMemoryInfo(
Ort::MemoryInfo::CreateCpu(allocatorType, memoryType)), mBatchSize(batchSize)
37 Ort::SessionOptions options;
38 options.SetIntraOpNumThreads(1);
50 for (
size_t i = 0;
i <
mSession->GetInputCount(); ++
i) {
53 for (
size_t i = 0;
i <
mSession->GetInputCount(); ++
i) {
56 for (
size_t i = 0;
i <
mSession->GetOutputCount(); ++
i) {
64 for (
auto& elem : shape) {
89 if (
mSession->GetInputCount() != input.size()) {
99 std::vector<const char*> tmpInputs;
100 std::vector<const char*> tmpOutputs;
107 mModelOutput =
mSession->Run(Ort::RunOptions{
nullptr},
133 std::scoped_lock guard(mMutex);
134 mBatch.emplace_back(input);
135 if (mBatch.size() == mBatchSize) {
136 auto value = std::optional(std::move(mBatch));
147 std::fstream
file(
path, std::fstream::in);
148 if (!
file.is_open()) {
158 if (scales.empty()) {
162 if (means.size() != scales.size()) {
165 return std::make_pair(std::move(means), std::move(scales));
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines the history is shortened to this when it reaches twice the size Time in seconds an info message fades out after setInfoTime h OpenGL display display Font size Do not use Freetype for font Renderer for event Frontend to use for event ROOT macros used as track filter Console script file
Meyers Singleton thread safe singleton. Responsible for collecting particle data for batch processing...
std::optional< std::vector< std::vector< float > > > getBatch(const std::vector< float > &input)
static BatchHandler & getInstance(size_t batchSize)
BatchHandler(const BatchHandler &)=delete
bool setInput(std::vector< std::vector< float > > &input) override
Implements setInput.
ConditionalModelSimulation(const std::string &modelPath, int64_t batchSize)
const std::vector< Ort::Value > & getResult() override
Returns single model output as const&. Returned vector is of size 1.
void run() override
Implements run().
Abstract class providing interface for various specialized implementations.
std::vector< Ort::Value > mInputTensors
Container for input tensors.
std::vector< std::string > mOutputNames
std::string mModelPath
model path (where to find the ONNX model)
std::vector< std::vector< int64_t > > mInputShapes
std::vector< std::string > mInputNames
Input/Output names and input shape.
void setInputOutputData()
Sets models metadata (input/output layers names, inputs shape) in onnx session.
NeuralFastSimulation(const std::string &modelPath, OrtAllocatorType allocatorType, OrtMemType memoryType, int64_t batchSize)
Ort::MemoryInfo mMemoryInfo
void setTensors(std::vector< std::vector< float > > &input)
Converts flattend input data to Ort::Value. Tensor shapes are taken from loaded model metadata.
Ort::AllocatorWithDefaultOptions mAllocator
void initRunSession()
(late) init session and provide mechanism to customize ONNX session with external options
size_t getBatchSize() const
GLsizei const GLfloat * value
GLsizei const GLchar *const * path
std::vector< float > parse_block(std::istream &input, const std::string &option)
Parses .txt file containing scales for model. Function will search for given marker (option) and read...
std::optional< std::pair< std::vector< float >, std::vector< float > > > loadScales(const std::string &path)
loads and parse model scales from file at path