ATLAS Offline Software
Public Types | Public Member Functions | Public Attributes | Private Member Functions | List of all members
FlavorTagDiscriminants::OnnxOutput Class Reference

#include <OnnxOutput.h>

Collaboration diagram for FlavorTagDiscriminants::OnnxOutput:

Public Types

enum  OutputType { OutputType::UNKNOWN, OutputType::FLOAT, OutputType::VECCHAR, OutputType::VECFLOAT }
 

Public Member Functions

 OnnxOutput (const std::string &name, ONNXTensorElementDataType type, int rank)
 
 OnnxOutput (const std::string &name, ONNXTensorElementDataType type, const std::string &name_in_model)
 

Public Attributes

const std::string name
 
const std::string name_in_model
 
const OutputType type
 

Private Member Functions

OutputType getOutputType (ONNXTensorElementDataType type, int rank) const
 
const std::string getName (const std::string &name, const std::string &model_name) const
 

Detailed Description

Definition at line 16 of file OnnxOutput.h.

Member Enumeration Documentation

◆ OutputType

Enumerator
UNKNOWN 
FLOAT 
VECCHAR 
VECFLOAT 

Definition at line 19 of file OnnxOutput.h.

19 {UNKNOWN, FLOAT, VECCHAR, VECFLOAT};

Constructor & Destructor Documentation

◆ OnnxOutput() [1/2]

FlavorTagDiscriminants::OnnxOutput::OnnxOutput ( const std::string &  name,
ONNXTensorElementDataType  type,
int  rank 
)

Definition at line 12 of file OnnxOutput.cxx.

15  : name(name),
17  type(getOutputType(type, rank)){}

◆ OnnxOutput() [2/2]

FlavorTagDiscriminants::OnnxOutput::OnnxOutput ( const std::string &  name,
ONNXTensorElementDataType  type,
const std::string &  name_in_model 
)

Definition at line 20 of file OnnxOutput.cxx.

23  : name(getName(name, model_name)),
25  type(getOutputType(type, 0)){}

Member Function Documentation

◆ getName()

const std::string FlavorTagDiscriminants::OnnxOutput::getName ( const std::string &  name,
const std::string &  model_name 
) const
private

Definition at line 27 of file OnnxOutput.cxx.

27  {
28  // unfortunately, this is block is needed to support some taggers that we schedule that don't have
29  // a well defined model name and rely on output remapping.
30  if (model_name == "UnknownModelName") {
31  return name;
32  }
33  return model_name + "_" + name;
34 }

◆ getOutputType()

OnnxOutput::OutputType FlavorTagDiscriminants::OnnxOutput::getOutputType ( ONNXTensorElementDataType  type,
int  rank 
) const
private

Definition at line 36 of file OnnxOutput.cxx.

36  {
37  // Determine the output node type based on the type and shape of the output tensor.
38  using ORT = ONNXTensorElementDataType;
39  if (type == ORT::ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT) {
40  if (rank == 0) {
41  return OutputType::FLOAT;
42  } else if (rank == 1) {
43  return OutputType::VECFLOAT;
44  }
45  } else if (type == ORT::ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8) {
46  return OutputType::VECCHAR;
47  }
48  return OutputType::UNKNOWN;
49 }

Member Data Documentation

◆ name

const std::string FlavorTagDiscriminants::OnnxOutput::name

Definition at line 31 of file OnnxOutput.h.

◆ name_in_model

const std::string FlavorTagDiscriminants::OnnxOutput::name_in_model

Definition at line 32 of file OnnxOutput.h.

◆ type

const OutputType FlavorTagDiscriminants::OnnxOutput::type

Definition at line 33 of file OnnxOutput.h.


The documentation for this class was generated from the following files:
python.StoreID.UNKNOWN
int UNKNOWN
Definition: StoreID.py:16
FlavorTagDiscriminants::OnnxOutput::OutputType::VECCHAR
@ VECCHAR
FlavorTagDiscriminants::OnnxOutput::OutputType::FLOAT
@ FLOAT
FlavorTagDiscriminants::OnnxOutput::name
const std::string name
Definition: OnnxOutput.h:31
FlavorTagDiscriminants::OnnxOutput::OutputType::VECFLOAT
@ VECFLOAT
FlavorTagDiscriminants::OnnxOutput::getOutputType
OutputType getOutputType(ONNXTensorElementDataType type, int rank) const
Definition: OnnxOutput.cxx:36
FlavorTagDiscriminants::OnnxOutput::type
const OutputType type
Definition: OnnxOutput.h:33
FlavorTagDiscriminants::OnnxOutput::name_in_model
const std::string name_in_model
Definition: OnnxOutput.h:32
FlavorTagDiscriminants::OnnxOutput::getName
const std::string getName(const std::string &name, const std::string &model_name) const
Definition: OnnxOutput.cxx:27
FlavorTagDiscriminants::ConstituentsEDMType::FLOAT
@ FLOAT
FlavorTagDiscriminants::OnnxOutput::OutputType::UNKNOWN
@ UNKNOWN