1#ifndef TMVA_SOFIE_RMODEL
2#define TMVA_SOFIE_RMODEL
9namespace Experimental {
21 std::unordered_map<std::string, InputTensorInfo>
27 std::unordered_map<std::string, std::string>
37 const std::string
SP =
" ";
66 void AddOperator(std::unique_ptr<ROperator> op,
int order_execution = -1);
69 std::unique_ptr<ROperator> tmp(op);
73 std::shared_ptr<void>
data);
75 std::shared_ptr<void>
data);
81 std::memcpy(data_ptr.get(), (
void*)
data,
length *
sizeof(T));
89 std::copy(
data.begin(),
data.end(), (T*) data_ptr.get());
95 void AddInitializedTensor(
const std::string & tensor_name,
const std::vector<std::size_t> & shape, T *raw_data)
99 std::memcpy(
data.get(), raw_data,
size *
sizeof(T));
124 UpdateOutputTensorList(std::vector<std::string> curr_output_tensor, std::vector<std::string> modify_output_tensor);
126 std::shared_ptr<void>
data);
129 void Initialize(
int batchSize = -1,
bool verbose =
false);
130 void Initialize(
const std::map<std::string,size_t> & inputParams,
bool verbose =
false);
132 void Generate(std::underlying_type_t<Options> options,
int batchSize = -1,
long pos = 0,
bool verbose =
false);
135 Generate(
static_cast<std::underlying_type_t<Options>
>(options), batchSize, pos, verbose);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
const ETensorType & GetTensorType(std::string name)
std::unordered_map< std::string, DynamicTensorInfo > fDynamicTensorInfos
bool IsDynamicTensor(const std::string &name) const
RModel(const RModel &other)=delete
const std::vector< std::string > & GetOutputTensorNames() const
void AddIntermediateTensor(std::string tensor_name, ETensorType type, std::vector< Dim > dim_shape)
void GenerateIntermediateTensorInfo()
std::vector< Dim > GetDynamicTensorShape(std::string name)
void AddOperatorReference(ROperator *op, int order_execution=-1)
void PrintIntermediateTensors()
std::string GenerateInferSignature(bool isdecl=true)
RModel(std::string function_name)
void PrintOutputTensors()
bool CheckIfTensorAlreadyExist(std::string tensor_name)
std::vector< std::unique_ptr< ROperator > > fOperators
void OutputGenerated(std::string filename="", bool append=false)
void AddInputTensorInfo(std::string input_name, ETensorType type, std::vector< Dim > shape)
std::unordered_map< std::string, TensorInfo > fIntermediateTensorInfos
void AddOutputTensorNameList(std::vector< std::string > output_tensor_names)
std::unordered_map< std::string, TensorInfo > fReadyInputTensorInfos
void AddConstantTensor(std::string tensor_name, ETensorType type, std::vector< std::size_t > shape, std::shared_ptr< void > data)
void AddDynamicTensor(std::string tensor_name, ETensorType type, std::vector< Dim > shape)
void AddInitializedTensor(std::string tensor_name, ETensorType type, std::vector< std::size_t > shape, std::shared_ptr< void > data)
RModel & operator=(RModel &&other)
void AddInputTensorName(std::string name)
void PrintDynamicTensors()
std::vector< std::string > fOutputTensorNames
void GenerateSessionCode()
void GenerateDynamicTensorInfo()
bool IsInitializedTensor(const std::string &name) const
void AddInitializedTensor(const std::string &tensor_name, const std::vector< std::size_t > &shape, T *raw_data)
void PrintInitializedTensors()
void AddOperator(std::unique_ptr< ROperator > op, int order_execution=-1)
RModel()=default
Default constructor.
void HeadInitializedTensors(std::string name, int n_print=50)
void Initialize(int batchSize=-1, bool verbose=false)
const std::vector< size_t > & GetTensorShape(std::string name)
bool IsInputTensor(const std::string &name) const
long WriteInitializedTensorsToFile(std::string filename="")
void Generate(std::underlying_type_t< Options > options, int batchSize=-1, long pos=0, bool verbose=false)
RModel & operator=(const RModel &other)=delete
void AddConstantTensor(const std::string &name, const std::vector< size_t > &shape, const std::vector< T > &data)
std::unordered_map< std::string, InputTensorInfo > fInputTensorInfos
std::shared_ptr< void > GetInitializedTensorData(std::string tensor_name)
void ReadInitializedTensorsFromFile(long)
void SetFilename(std::string filename)
void InitializeSubGraph(std::shared_ptr< RModel > graph)
std::unordered_map< std::string, std::string > fShapeParams
void SetNotWritableInitializedTensor(const std::string &tensor_name)
void GenerateInitializedTensorInfo()
std::vector< std::string > fInputTensorNames
const std::vector< std::string > & GetInputTensorNames() const
std::unordered_map< std::string, InitializedTensor > fInitializedTensors
void UpdateInitializedTensor(std::string tensor_name, ETensorType type, std::vector< std::size_t > shape, std::shared_ptr< void > data)
std::vector< std::string > GetOutputTensorNames()
std::vector< std::shared_ptr< RModel > > fSubGraphs
! sub-graph models (transient)
void UpdateOutputTensorList(std::vector< std::string > curr_output_tensor, std::vector< std::string > modify_output_tensor)
RModel(std::string name, std::string parsedtime)
void AddConstantTensor(const std::string &name, const std::vector< size_t > &shape, const T *data)
void PrintRequiredInputTensors()
void Generate(Options options=Options::kDefault, int batchSize=-1, int pos=0, bool verbose=false)
ETensorType GetTemplatedType(T)
std::size_t ConvertShapeToLength(std::vector< size_t > shape)
create variable transformations