1#ifndef TMVA_SOFIE_ROPERATOR_RANGE
2#define TMVA_SOFIE_ROPERATOR_RANGE
11namespace Experimental{
29 ROperator_Range(std::string start, std::string limit, std::string delta, std::string nameOutput):
31 fNOutput(UTILITY::Clean_name(nameOutput)) {
32 if (std::is_same<T, float>::value) {
34 }
else if (std::is_same<T, int64_t>::value) {
37 static_assert( (std::is_same_v<T, float> || std::is_same_v<T, int64_t>),
38 "TMVA::SOFIE - Unsupported type by Range operator");
54 std::runtime_error(
"TMVA SOFIE Range Op Input Tensor " +
fNStart +
"is not found in model");
58 std::runtime_error(
"TMVA SOFIE Range Op Input Tensor " +
fNLimit +
"is not found in model");
62 std::runtime_error(
"TMVA SOFIE Range Op Input Tensor " +
fNDelta +
"is not found in model");
69 std::string
Generate(std::string OpName)
override {
70 OpName =
"op_" + OpName;
72 throw std::runtime_error(
"TMVA SOFIE Range operator called to Generate without being initialized first");
74 std::stringstream out;
75 out <<
"\n//------ Range\n";
76 std::string sizeName =
fShape[0].param;
77 out <<
SP <<
"size_t " << sizeName <<
" = static_cast<size_t>(std::max(std::ceil((static_cast<float>(*tensor_" <<
fNLimit <<
") - static_cast<float>(*tensor_" <<
fNStart <<
")) / static_cast<float>(*tensor_" <<
fNDelta <<
")), 0.0f));\n";
78 out <<
SP <<
"if (" << sizeName <<
" > " <<
"fTensor_" <<
fNOutput <<
".size() ){\n";
79 out <<
SP <<
SP <<
"fTensor_" <<
fNOutput <<
".resize(" << sizeName <<
");\n";
83 out <<
SP <<
"for (size_t i = 0; i < " << sizeName <<
"; i++) {\n";
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
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
bool CheckIfTensorAlreadyExist(std::string tensor_name)
void AddDynamicTensor(std::string tensor_name, ETensorType type, std::vector< Dim > shape)
ROperator_Range(std::string start, std::string limit, std::string delta, std::string nameOutput)
std::vector< ETensorType > TypeInference(std::vector< ETensorType > input) override
std::vector< Dim > fShape
void Initialize(RModel &model) override
std::vector< std::vector< size_t > > ShapeInference(std::vector< std::vector< size_t > > input) override
std::string Generate(std::string OpName) override
const std::string SP
space used to correctly indent the generated C++ code
ETensorType ConvertStringToType(std::string type)
create variable transformations