74 triton_input.
setShape({
static_cast<long int>(vec.size())});
82 ,
minHits(p.get<
size_t>(
"minHits"))
83 ,
debug(p.get<
bool>(
"debug"))
84 ,
planes(p.get<vector<std::string>>(
"planes"))
98 for (
auto const& tool_pset_labels : tool_psets.get_pset_names()) {
99 std::cout <<
"decoder lablel: " << tool_pset_labels << std::endl;
113 vector<art::Ptr<Hit>> hitlist;
114 vector<vector<size_t>> idsmap;
115 vector<NuGraphInput> graphinputs;
116 _loaderTool->loadData(e, hitlist, graphinputs, idsmap);
118 if (
debug) std::cout <<
"Hits size=" << hitlist.size() << std::endl;
119 if (hitlist.size() <
minHits) {
130 auto start = std::chrono::high_resolution_clock::now();
134 size_t batchSize = 1;
138 for (
auto& input_pair : inputs) {
139 const std::string& key = input_pair.first;
140 auto& triton_input = input_pair.second;
142 for (
auto& gi : graphinputs) {
143 if (key != gi.input_name)
continue;
154 auto end = std::chrono::high_resolution_clock::now();
155 std::chrono::duration<double> elapsed =
end - start;
156 std::cout <<
"Time taken for inference: " << elapsed.count() <<
" seconds" << std::endl;
161 vector<NuGraphOutput> infer_output;
162 for (
const auto& [name, data] : infer_result) {
163 const auto& prob = data.fromServer<
float>();
164 std::vector<float> out_data(prob[0].
begin(), prob[0].
end());
165 infer_output.emplace_back(name, std::move(out_data));
bool setShape(const ShapeType &newShape)
std::unique_ptr< LoaderToolBase > _loaderTool
fhicl::ParameterSet tritonPset
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
NuGraphInferenceSonicTriton & operator=(NuGraphInferenceSonicTriton const &)=delete
void produce(art::Event &e) override
void toServer(std::shared_ptr< TritonInput< DT >> ptr)
NuGraphInferenceSonicTriton(fhicl::ParameterSet const &p)
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
#define DEFINE_ART_MODULE(klass)
void setShapeAndToServer(lartriton::TritonData< triton::client::InferInput > &triton_input, vector< T > &vec, size_t batchSize)
std::vector< std::vector< DT >> TritonInput
T get(std::string const &key) const
std::vector< std::unique_ptr< DecoderToolBase > > _decoderToolsVec
ProducesCollector & producesCollector() noexcept
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
2D representation of charge deposited in the TDC/wire plane
vector< std::string > planes
std::unique_ptr< lartriton::TritonClient > triton_client
std::string to_string() const