Project
Loading...
Searching...
No Matches
Processors.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17#ifndef O2_ZDC_FAST_SIMULATIONS_PROCESSORS_H
18#define O2_ZDC_FAST_SIMULATIONS_PROCESSORS_H
19
20#if __has_include(<onnxruntime/core/session/onnxruntime_cxx_api.h>)
21#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
22#else
23#include <onnxruntime_cxx_api.h>
24#endif
25#include <optional>
26#include <vector>
27
29{
30
32{
33 public:
34 StandardScaler() = default;
35 ~StandardScaler() = default;
36
43 [[nodiscard]] std::optional<std::vector<float>> scale(const std::vector<float>& data) const;
44
51 [[nodiscard]] std::optional<std::vector<std::vector<float>>> scale_batch(
52 const std::vector<std::vector<float>>& data) const;
53
62 bool setScales(const std::vector<float>& means, const std::vector<float>& scales);
63
64 private:
65 std::vector<float> mMeans;
66 std::vector<float> mScales;
67};
68
76std::vector<int> readClassifier(const Ort::Value& value, size_t batchSize);
77
85std::vector<std::array<long, 5>> calculateChannels(const Ort::Value& value, size_t batchSize);
86
87} // namespace o2::zdc::fastsim::processors
88#endif // O2_ZDC_FAST_SIMULATIONS_PROCESSORS_H
bool setScales(const std::vector< float > &means, const std::vector< float > &scales)
Sets scales for standard scaler. Checks if sizes of scales are equal.
std::optional< std::vector< float > > scale(const std::vector< float > &data) const
Scales data with standard scale algorithm.
std::optional< std::vector< std::vector< float > > > scale_batch(const std::vector< std::vector< float > > &data) const
Scales batch of data with standard scale algorithm.
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLboolean * data
Definition glcorearb.h:298
std::vector< int > readClassifier(const Ort::Value &value, size_t batchSize)
Reads predicted class as int.
std::vector< std::array< long, 5 > > calculateChannels(const Ort::Value &value, size_t batchSize)
Calculate 5 channels values from 44x44 float array (for every batch)