7#ifdef SOFIE_SUPPORT_ROOT_BINARY
15namespace Experimental {
19const std::string SP =
" ";
23 return static_cast<std::underlying_type_t<Options>
>(
opA) |
static_cast<std::underlying_type_t<Options>
>(
opB);
26 return opA |
static_cast<std::underlying_type_t<Options>
>(
opB);
32 return f->second.shape;
36 return f2->second.shape();
40 throw std::runtime_error(
"TMVA SOFIE tensor [" +
name +
"] is an input tensor with unspecified dimension parameter");
44 return f4->second.shape;
47 throw std::runtime_error(
"TMVA SOFIE tensor [" +
name +
"] is a dynamic tensor. Use GetDynamicTensorShape instead of GetTensorShape");
52 throw std::runtime_error(
"TMVA SOFIE tensor [" +
name +
"] for which the shape is requested is not found");
57 return f->second.shape;
60 return f->second.shape;
70 return f->second.type;
74 return f2->second.type();
78 return f3->second.type;
82 return f4->second.type;
86 return f5->second.type;
92 throw std::runtime_error(
"TMVA SOFIE tensor [" +
name +
"] for which the type is requested is not found, model name: " +
fName);
108 throw std::runtime_error(
"TMVA-SOFIE: input tensor with name " +
input_name +
" already exists \n");
118 throw std::runtime_error(
"TMVA-SOFIE: input tensor with name " +
input_name +
" already exists \n");
130 auto libs =
op->GetStdLibs();
159 throw std::runtime_error(
"TMVA-SOFIE: initialized tensor with name " + tensor_name +
" already exists \n");
169 throw std::runtime_error(
"TMVA-SOFIE: initialized tensor with name " + tensor_name +
" already exists \n");
183 return itr->second.IsConstantTensor();
211 throw std::runtime_error(
"TMVA-SOFIE: intermediate tensor with name " + tensor_name +
" already exists \n");
220 throw std::runtime_error(
"TMVA-SOFIE: intermediate tensor with name " + tensor_name +
" already exists \n");
225 for (
auto &
d : shape) {
230 if (
d.dim !=
size_t(-1)) {
255 throw std::runtime_error(
"TMVA-SOFIE: tensor " + tensor_name +
" not found when trying to update it");
264 throw std::runtime_error(
"TMVA-SOFIE: tensor " + tensor_name +
" not found when trying to get its data");
266 return f->second.sharedptr();
273 throw std::runtime_error(
"TMVA-SOFIE: initialized tensor " + tensor_name +
" not found when trying to get its info");
275 t->second.SetNotWritable();
280 std::stringstream code;
284 code <<
"\n // Allocating memory for intermediate tensor " <<
name <<
" with size " <<
size <<
" bytes";
286 << typeName <<
"* tensor_" <<
name <<
" = reinterpret_cast<" << typeName
287 <<
"*>(fIntermediateMemoryPool.data() + " << location <<
");\n";
291 std::string
name = std::string{it};
302 if (
chunk->second >= tensor_size) {
308 chunk->second -= tensor_size;
312 if (
chunk->second == 0) {
340 if (
chunk->second.tensor_name == it) {
362 chunk->second.tensor_size
389 std::cout <<
"Model is already initialized - skip initialization " << std::endl;
400 if (verbose) std::cout <<
"looking at the tensor " <<
input.first << std::endl;
403 for (
auto &
d :
input.second.shape) {
405 std::string
pname =
d.param;
411 std::cout <<
"Tensor: " <<
input.first <<
" - fix parametric shape " <<
itr->first <<
" to " <<
itr->second << std::endl;
421 if (!shape.empty()) {
433 for (
auto &
d :
input.second.shape) {
466 std::cout <<
"Initializing operator " << i <<
" " <<
typeid(
r).
name() << std::endl;
470 std::string
name = std::string{it};
488 graph->fParentGraph =
this;
489 graph->fIsSubGraph =
true;
498 for (
auto &
e : graph->fNeededBlasRoutines)
501 for (
auto e : graph->fNeededStdLib)
506 graph->fInputTensorNames.emplace_back(
name);
518 std::stringstream
strs;
524 const T *
data = t.second.data<T>();
539 strs <<
"std::vector<" <<
type <<
"> fTensor_" << t.first <<
" = ";
545 strs <<
"const " <<
type <<
" * tensor_" + t.first +
" = fTensor_" + t.first +
".data();\n";
553 fGC +=
"// initialized tensors\n";
566 fGC +=
"std::vector<float> fTensor_" + i.first +
" = std::vector<float>(" + std::to_string(
length) +
");\n";
567 fGC +=
"float * tensor_" + i.first +
" = fTensor_" + i.first +
".data();\n";
575 fGC +=
"\n//--- Allocating session memory pool to be used for allocating intermediate tensors\n";
581 fGC +=
"std::vector<char> fIntermediateMemoryPool = std::vector<char>(" + std::to_string(
memPoolSize) +
");\n\n";
624 fGC +=
"//--- declare the dynamic tensors\n";
627 fGC +=
"std::vector<float> fTensor_" + i.first +
";\n";
628 fGC +=
"float * tensor_" + i.first +
" = nullptr;\n";
630 fGC +=
"std::vector<double> fTensor_" + i.first +
";\n";
631 fGC +=
"double * tensor_" + i.first +
" = nullptr;\n";
633 fGC +=
"std::vector<int64_t> fTensor_" + i.first +
";\n";
634 fGC +=
"int64_t * tensor_" + i.first +
" = nullptr;\n";
647 fGC +=
"\n//---- operator declarations \n";
654 std::stringstream out;
657 out << SP <<
"if (" <<
length <<
" > 0) {\n";
658 out << SP << SP <<
"fTensor_" << i.first <<
".resize(" <<
length <<
");\n";
659 out << SP << SP <<
"tensor_" << i.first <<
" = fTensor_" << i.first <<
".data();\n";
675 for (
auto &
d : shape) {
676 std::string
pName =
d.param;
680 rGC +=
d.param +
",";
688 throw std::runtime_error(
"TMVA-SOFIE: input tensor " +
name +
689 " is of a data type which is not yet supported.");
720 if (outputSize == 1) {
732 for (
size_t i = 0; i < outputSize; i++) {
734 if (i < outputSize - 1)
756 fGC += SP +
"return {";
782 fGC +=
"struct Session {\n";
784 fGC +=
"struct Session_" +
fName +
" {\n";
821 fGC +=
"Session_" + graph->fName +
" fSession_" + graph->fName +
";\n";
831 for (
size_t id = 0;
id <
fOperators.size();
id++) {
832 std::string
opName = std::to_string(
id);
838 std::string fileName =
fName;
845 fGC +=
sessionName +
"(std::string filename =\"" + fileName +
"\"";
856 fGC +=
" size_t " +
p.first +
" = " +
p.second;
862 fGC +=
"\n//--- reading weights from file\n";
872 for (
size_t id = 0;
id <
fOperators.size();
id++) {
884 std::cout <<
"Generating main inference code for " <<
fName << std::endl;
887 throw std::runtime_error(
"TMVA-SOFIE: output size=0 are not supported");
891 std::cout <<
"Generating code for operator .... " <<
op_idx << std::endl;
895 fGC += SP +
"using TMVA::Experimental::SOFIE::UTILITY::FillOutput;\n\n";
903 fGC += SP +
"FillOutput(tensor_" +
name +
", output_tensor_" +
name +
", " +
n +
");\n";
913 fGC +=
"}; // end of Session\n\n";
917void RModel::Generate(std::underlying_type_t<Options> options,
int batchSize,
long pos,
bool verbose)
937 throw std::runtime_error(
938 "TMVA-SOFIE: RModel::Generate: cannot use a separate weight file without generating a Session class");
941 if (
static_cast<std::underlying_type_t<Options>
>(
Options::kGNN) & options)
958 std::cout <<
"generate session code for subgraph " << graph->fName << std::endl;
959 graph->GenerateSessionCode();
964 std::cout <<
"generate Main session code - model " <<
fName << std::endl;
970 fGC += (
"} //TMVA_SOFIE_" +
fName +
"\n");
980 fGC +=
" std::ifstream f;\n";
981 fGC +=
" f.open(filename);\n";
982 fGC +=
" if (!f.is_open()) {\n";
983 fGC +=
" throw std::runtime_error(\"tmva-sofie failed to open file \" + filename + \" for input weights\");\n";
987 fGC +=
" f.seekg(" + std::to_string(pos) +
");\n";
990 fGC +=
" std::string tensor_name;\n";
991 fGC +=
" size_t length;\n";
996 if (!i.second.IsWeightTensor())
continue;
997 std::string tensor_name =
"tensor_" + i.first;
1002 fGC +=
" f >> tensor_name >> length;\n";
1003 fGC +=
" if (tensor_name != \"" + tensor_name +
"\" ) {\n";
1004 fGC +=
" std::string err_msg = \"TMVA-SOFIE failed to read the correct tensor name; expected name is " +
1005 tensor_name +
" , read \" + tensor_name;\n";
1006 fGC +=
" throw std::runtime_error(err_msg);\n";
1008 fGC +=
" if (length != " +
slength +
") {\n";
1009 fGC +=
" std::string err_msg = \"TMVA-SOFIE failed to read the correct tensor size; expected size is " +
1010 slength +
" , read \" + std::to_string(length) ;\n";
1011 fGC +=
" throw std::runtime_error(err_msg);\n";
1013 fGC +=
" for (size_t i = 0; i < length; ++i)\n";
1014 fGC +=
" f >> " + tensor_name +
"[i];\n";
1015 fGC +=
" if (f.fail()) {\n";
1016 fGC +=
" throw std::runtime_error(\"TMVA-SOFIE failed to read the values for tensor " + tensor_name +
"\");\n";
1019 std::runtime_error(
"tmva-sofie tensor " + tensor_name +
" with type " +
ConvertTypeToString(i.second.type()) +
" cannot be read from a file");
1022 fGC +=
" f.close();\n";
1027#ifdef SOFIE_SUPPORT_ROOT_BINARY
1029 fGC +=
" std::unique_ptr<TFile> rootFile(TFile::Open(filename.c_str(), \"READ\"));\n";
1030 fGC +=
" if (!rootFile->IsOpen()) {\n";
1031 fGC +=
" throw std::runtime_error(\"tmva-sofie failed to open ROOT file for input weights\");\n";
1035 fGC +=
" if (!rootFile->GetKey(\"" +
dirName +
"\")) {\n";
1036 fGC +=
" throw std::runtime_error(\"tmva-sofie failed to open ROOT directory for input weights\");\n";
1041 if (!i.second.IsWeightTensor())
continue;
1043 std::string tensor_name =
"tensor_" + i.first;
1045 fGC +=
" fTensor_" + i.first +
" = *reinterpret_cast<std::vector<float>*>(rootFile->Get(\"";
1046 fGC +=
dirName +
"/" + tensor_name +
"\"));\n";
1048 fGC +=
" fTensor_" + i.first +
" = *reinterpret_cast<std::vector<double>*>(rootFile->Get(\"";
1049 fGC +=
dirName + +
"/" + tensor_name +
"\"));\n";
1051 fGC +=
" fTensor_" + i.first +
" = *reinterpret_cast<std::vector<int64_t>*>(rootFile->Get(\"";
1052 fGC +=
dirName +
"/" + tensor_name +
"\"));\n";
1054 std::runtime_error(
"tmva-sofie tensor " + tensor_name +
" with type " +
ConvertTypeToString(i.second.type()) +
" cannot be read from a ROOT file");
1060 throw std::runtime_error(
"SOFIE was not built with ROOT file support.");
1087#ifdef SOFIE_SUPPORT_ROOT_BINARY
1089 throw std::runtime_error(
"SOFIE-GNN yet not supports writing to a ROOT file.");
1102 if (!
item.second.IsWeightTensor())
continue;
1107 const float*
data =
item.second.data<
float>();
1112 const double*
data =
item.second.data<
double>();
1117 const int64_t*
data =
item.second.data<int64_t>();
1123 " cannot be written to a ROOT file");
1132 throw std::runtime_error(
"SOFIE was not built with ROOT file support.");
1144 std::runtime_error(
"tmva-sofie failed to open file " +
filename +
" for tensor weight data");
1147 if (!i.second.IsWeightTensor()) {
1151 std::string tensor_name =
"tensor_" + i.first;
1152 f << tensor_name <<
" " <<
length <<
"\n";
1154 const float *
data = i.second.data<
float>();
1155 for (
size_t idx = 0; idx <
length; idx++) {
1158 if (
value != 0. && std::abs(
value) < std::numeric_limits<float>::min() )
value = 0;
1159 f << std::setprecision(std::numeric_limits<float>::max_digits10) <<
value;
1160 f << ( (idx <
length-1) ?
" " :
"\n" );
1164 std::runtime_error(
"tmva-sofie tensor " + tensor_name +
" with type " +
ConvertTypeToString(i.second.type()) +
" cannot be written to a file");
1167 std::runtime_error(
"tmva-sofie failed to write tensor data to file for " + tensor_name);
1178 std::cout <<
"Model requires following inputs:\n";
1180 std::cout <<
"Parametrised Tensor name: " <<
inputInfo.first <<
"\t";
1182 std::cout <<
"shape: [";
1183 for (
size_t i = 0; i <
inputInfo.second.shape.size(); i++) {
1184 if (
inputInfo.second.shape[i].isParam) {
1185 std::cout <<
inputInfo.second.shape[i].param;
1187 std::cout <<
inputInfo.second.shape[i].dim ;
1189 if (i <
inputInfo.second.shape.size() - 1) std::cout <<
",";
1191 std::cout <<
"]" << std::endl;
1195 std::cout <<
"Fully Specified Tensor name: " <<
inputInfo.first <<
"\t";
1197 std::cout <<
"shape: [";
1198 for (
size_t i = 0; i <
inputInfo.second.shape.size(); i++) {
1200 if (i <
inputInfo.second.shape.size() - 1) std::cout <<
",";
1202 std::cout <<
"]" << std::endl;
1208 std::cout <<
"Model initialized the following tensors:\n";
1210 std::cout <<
"Tensor name: \"" << it.first <<
"\"\t";
1212 std::cout <<
"shape: [";
1213 for (
size_t i = 0; i < it.second.shape().
size(); i++) {
1214 std::cout << it.second.shape()[i];
1215 if (i < it.second.shape().size() - 1) std::cout <<
",";
1218 if (it.second.IsConstantTensor()) std::cout <<
" (Constant)";
1219 else if (!it.second.IsWeightTensor()) std::cout <<
" (Not Writable)";
1220 std::cout << std::endl;
1226 std::cout <<
"Model specify the following intermediate tensors:\n";
1228 std::cout <<
"Tensor name: \"" << it.first <<
"\"\t";
1230 std::cout <<
"shape: [";
1231 for (
size_t i = 0; i < it.second.shape.size(); i++) {
1232 std::cout << it.second.shape[i];
1233 if (i < it.second.shape.size() - 1) std::cout <<
",";
1235 std::cout <<
"]" << std::endl;
1241 std::cout <<
"Model specify the following dynamic tensors:\n";
1243 std::cout <<
"Tensor name: \"" << it.first <<
"\"\t";
1245 std::cout <<
"shape: [";
1246 for (
size_t i = 0; i < it.second.shape.size(); i++) {
1247 std::cout << it.second.shape[i].GetVal();
1248 if (i < it.second.shape.size() - 1) std::cout <<
",";
1250 std::cout <<
"]" << std::endl;
1256 std::cout <<
"Model specify the following output tensors:\n";
1258 std::cout <<
"Tensor name: \"" << it <<
"\"\t";
1270 std::cout <<
"Tensor " <<
name <<
" not found in model's initialized tensor list" << std::endl;
1274 std::cout <<
"Tensor name: " << it->first <<
"\t";
1277 std::cout <<
"shape: [";
1278 for (
size_t i = 0; i < it->second.shape().
size(); i++) {
1279 std::cout << it->second.shape()[i];
1280 length *= it->second.shape()[i];
1281 if (
i < it->second.shape().size() - 1) std::cout <<
",";
1283 std::cout <<
"]" << std::endl;
1290 std::cout <<
"data: [" << std::endl;
1293 for (
int i =0; i <
n_print; i++) {
1295 if (i <
n_print - 1) std::cout <<
" ,";
1298 if (
ellipsis) std::cout <<
", ...";
1299 std::cout <<
"]" << std::endl;
1310 size_t pos =
filename.find(
".hxx");
1326 if (
R__b.IsReading()) {
1327 RModel::Class()->ReadBuffer(
R__b,
this);
1329 i.second.CastPersistentToShared();
1334 i.second.CastSharedToPersistent();
1336 RModel::Class()->WriteBuffer(
R__b,
this);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
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 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 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 r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
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 id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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_iterator begin() const
const_iterator end() const
Buffer base class used for serializing objects.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
void GenerateHeaderInfo(std::string &hgname)
void OutputGenerated(std::string filename="", bool append=false)
WeightFileType fWeightFile
void AddBlasRoutines(std::vector< std::string > routines)
void AddNeededStdLib(std::string libname)
std::unordered_map< std::string, DynamicTensorInfo > fDynamicTensorInfos
bool IsDynamicTensor(const std::string &name) const
void AddIntermediateTensor(std::string tensor_name, ETensorType type, std::vector< Dim > dim_shape)
void GenerateIntermediateTensorInfo()
void PrintIntermediateTensors()
std::string GenerateInferSignature(bool isdecl=true)
void GenerateOperatorDeclarations()
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)
std::unordered_map< std::string_view, size_t > fIntermediateTensorFrequencyLookup
! lookup table for intermediate tensor frequency (transient)
void AddInputTensorName(std::string name)
void PrintDynamicTensors()
std::vector< std::string > fOutputTensorNames
const ETensorType & GetTensorType(std::string name) const
void GenerateSessionCode()
bool IsDimInputTensor(const std::string &name) const
void GenerateDynamicTensorInfo()
bool IsInitializedTensor(const std::string &name) const
const std::vector< size_t > & GetTensorShape(std::string name) const
void CheckAndFlushIntermediateMemory(std::span< const std::string_view > op_output_tensors, const size_t &op_idx)
void PrintInitializedTensors()
void AddOperator(std::unique_ptr< ROperator > op, int order_execution=-1)
void HeadInitializedTensors(std::string name, int n_print=50)
bool IsConstantTensor(const std::string &name) const
void Initialize(int batchSize=-1, bool verbose=false)
long WriteInitializedTensorsToFile(std::string filename="")
OptimizationLevel fOptimizationLevel
void Generate(std::underlying_type_t< Options > options, int batchSize=-1, long pos=0, bool verbose=false)
std::unordered_map< std::string, InputTensorInfo > fInputTensorInfos
std::shared_ptr< void > GetInitializedTensorData(std::string tensor_name)
std::vector< Dim > GetDynamicTensorShape(std::string name) const
MemoryPoolInfo fIntermediateMemoryInfo
! intermediate memory info (transient)
void GenerateIntermediateMemoryPool()
void ReadInitializedTensorsFromFile(long)
std::string AllocateIntermediateMemory(std::span< const std::string_view > op_output_tensors)
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
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::shared_ptr< RModel > > fSubGraphs
! sub-graph models (transient)
bool IsReadyInputTensor(const std::string &name) const
void UpdateOutputTensorList(std::vector< std::string > curr_output_tensor, std::vector< std::string > modify_output_tensor)
void PrintRequiredInputTensors()
std::string Clean_name(std::string input_tensor_name)
std::vector< Dim > ConvertShapeToDim(std::vector< size_t > shape)
Convert shape from integer format to dynamic one (based on Dim)
std::string ConvertDynamicShapeToLength(std::vector< Dim > shape)
constexpr size_t GetTypeSize(ETensorType type)
std::string ConvertValuesToString(size_t n, const T *data)
std::string ConvertShapeToString(std::vector< size_t > shape)
std::string GenerateConstantTensorCode(const std::pair< std::string, InitializedTensor > &t)
std::string ConvertTypeToString(ETensorType type)
std::string ConvertDynamicShapeToString(std::vector< Dim > shape)
std::underlying_type_t< Options > operator|(Options opA, Options opB)
std::vector< size_t > ConvertShapeToInt(std::vector< Dim > shape)
Convert shape based on Dim to integer format.
std::string ConvertValToString(T value)
std::size_t ConvertShapeToLength(std::vector< size_t > shape)
create variable transformations
std::map< size_t, TensorMemoryInfo > total_stack
std::map< size_t, size_t > available_stack