ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
JetTagging
FlavorTagInference
Root
SaltModelOutput.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
4
This class is used to store the configuration for a ONNX output node.
5
*/
6
7
#include "
FlavorTagInference/SaltModelOutput.h
"
8
9
namespace
FlavorTagInference
{
10
11
/* constructor for SaltModelVersion::V1 and higher */
12
SaltModelOutput::SaltModelOutput
(
const
std::string&
name
,
13
const
ONNXTensorElementDataType
type
,
14
int
rank)
15
:
name
(
name
),
16
name_in_model
(
name
),
17
type
(
getOutputType
(
type
, rank)){}
18
19
/* constructor for SaltModelVersion::V0 */
20
SaltModelOutput::SaltModelOutput
(
const
std::string&
name
,
21
const
ONNXTensorElementDataType
type
,
22
const
std::string& model_name)
23
:
name
(
getName
(
name
, model_name)),
24
name_in_model
(
name
),
25
type
(
getOutputType
(
type
, 0)){}
26
27
/* constructor for parametric reduced-precision float32 (VECTRUNCFLOAT with explicit E,M) */
28
SaltModelOutput::SaltModelOutput
(
const
std::string&
name
,
29
OutputType
type
,
30
float
scale
,
31
int
exp_bits_in,
32
int
man_bits_in)
33
:
name
(
name
),
34
name_in_model
(
name
),
35
type
(
type
),
36
scale
(
scale
),
37
exp_bits
(exp_bits_in),
38
man_bits
(man_bits_in){}
39
40
const
std::string
SaltModelOutput::getName
(
const
std::string&
name
,
const
std::string& model_name) {
41
// unfortunately, this is block is needed to support some taggers that we schedule that don't have
42
// a well defined model name and rely on output remapping.
43
if
(model_name ==
"UnknownModelName"
) {
44
return
name
;
45
}
46
return
model_name +
"_"
+
name
;
47
}
48
49
SaltModelOutput::OutputType
SaltModelOutput::getOutputType
(ONNXTensorElementDataType
type
,
int
rank)
const
{
50
// Determine the output node type based on the type and shape of the output tensor.
51
using
ORT = ONNXTensorElementDataType;
52
if
(
type
== ORT::ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT) {
53
if
(rank == 0) {
54
return
OutputType::FLOAT
;
55
}
else
if
(rank == 1) {
56
return
OutputType::VECFLOAT
;
57
}
58
}
else
if
(
type
== ORT::ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8) {
59
return
OutputType::VECCHAR
;
60
}
else
if
(
type
== ORT::ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32) {
61
if
(rank == 1) {
62
return
OutputType::VECINT
;
63
}
64
}
65
return
OutputType::UNKNOWN
;
66
}
67
68
}
// namespace FlavorTagInference
SaltModelOutput.h
FlavorTagInference::SaltModelOutput::man_bits
int man_bits
Definition
SaltModelOutput.h:43
FlavorTagInference::SaltModelOutput::getOutputType
OutputType getOutputType(ONNXTensorElementDataType type, int rank) const
Definition
SaltModelOutput.cxx:49
FlavorTagInference::SaltModelOutput::type
const OutputType type
Definition
SaltModelOutput.h:40
FlavorTagInference::SaltModelOutput::name
const std::string name
Definition
SaltModelOutput.h:38
FlavorTagInference::SaltModelOutput::scale
const float scale
Definition
SaltModelOutput.h:41
FlavorTagInference::SaltModelOutput::SaltModelOutput
SaltModelOutput(const std::string &name, ONNXTensorElementDataType type, int rank)
Definition
SaltModelOutput.cxx:12
FlavorTagInference::SaltModelOutput::getName
static const std::string getName(const std::string &name, const std::string &model_name)
Definition
SaltModelOutput.cxx:40
FlavorTagInference::SaltModelOutput::name_in_model
const std::string name_in_model
Definition
SaltModelOutput.h:39
FlavorTagInference::SaltModelOutput::exp_bits
int exp_bits
Definition
SaltModelOutput.h:42
FlavorTagInference::SaltModelOutput::OutputType
OutputType
Definition
SaltModelOutput.h:19
FlavorTagInference::SaltModelOutput::OutputType::VECCHAR
@ VECCHAR
Definition
SaltModelOutput.h:19
FlavorTagInference::SaltModelOutput::OutputType::UNKNOWN
@ UNKNOWN
Definition
SaltModelOutput.h:19
FlavorTagInference::SaltModelOutput::OutputType::VECINT
@ VECINT
Definition
SaltModelOutput.h:19
FlavorTagInference::SaltModelOutput::OutputType::VECFLOAT
@ VECFLOAT
Definition
SaltModelOutput.h:19
FlavorTagInference::SaltModelOutput::OutputType::FLOAT
@ FLOAT
Definition
SaltModelOutput.h:19
FlavorTagInference
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition
CaloClusterLoader.h:27
Generated on
for ATLAS Offline Software by
1.17.0