#include "SaltModelTriton.h"
#include "FlavorTagInference/SaltModelGraphConfig.h"
#include "FlavorTagInference/SaltModelOutput.h"
#include "CxxUtils/checker_macros.h"
#include <onnxruntime_cxx_api.h>
#include <stdexcept>
#include <tuple>
#include <set>
#include <memory>
Go to the source code of this file.
|
| namespace | FlavorTagInference |
| | This file contains "getter" functions used for accessing tagger inputs from the EDM.
|
|
| template<typename T> |
| bool | prepareInput (const std::string &name, const std::vector< int64_t > &shape, const std::vector< T > &data, std::vector< std::shared_ptr< tc::InferInput > > &inputs) |
| template<typename T> |
| bool | extractOutput (const std::string &name, const std::shared_ptr< tc::InferResult > &result, std::vector< T > &outputVec) |
◆ extractOutput()
template<typename T>
| bool extractOutput |
( |
const std::string & | name, |
|
|
const std::shared_ptr< tc::InferResult > & | result, |
|
|
std::vector< T > & | outputVec ) |
Definition at line 55 of file SaltModelTriton.cxx.
58{
59 const uint8_t* rawData =
nullptr;
60 size_t size = 0;
61
62
63
64
65 tc::Error
err =
result->RawData(name, &rawData, &size);
67 std::cerr <<
"Unable to get raw output for: " +
name << std::endl;
68 return false;
69 }
70
71 outputVec.resize(size / sizeof(T));
72 std::memcpy(outputVec.data(), rawData, size);
73 return true;
74}
◆ prepareInput()
template<typename T>
| bool prepareInput |
( |
const std::string & | name, |
|
|
const std::vector< int64_t > & | shape, |
|
|
const std::vector< T > & | data, |
|
|
std::vector< std::shared_ptr< tc::InferInput > > & | inputs ) |
Definition at line 22 of file SaltModelTriton.cxx.
26{
28 tc::InferInput* rawInputPtr = nullptr;
29
30
31 tc::Error
err = tc::InferInput::Create(&rawInputPtr, name, shape, dtype);
33 std::cerr <<
"Unable to create input: " +
name << std::endl;
34 return false;
35 }
36
37
38
39
40
41
42 std::shared_ptr<tc::InferInput>
input(rawInputPtr);
44 data.size() *
sizeof(T));
46 std::cerr <<
"Unable to set input data for: " +
name << std::endl;
47 return false;
48 }
49
50 inputs.push_back(std::move(input));
51 return true;
52}
char data[hepevt_bytes_allocation_ATLAS]