13namespace Experimental {
17 return static_cast<std::underlying_type_t<Options>
>(
opA) |
static_cast<std::underlying_type_t<Options>
>(
opB);
20 return opA |
static_cast<std::underlying_type_t<Options>
>(
opB);
59 return f->second.shape;
63 return f2->second.shape();
67 throw std::runtime_error(
"TMVA SOFIE tensor [" +
name +
"] is an input tensor with unspecified dimension parameter");
71 return f4->second.shape;
74 throw std::runtime_error(
"TMVA SOFIE tensor [" +
name +
"] is a dynamic tensor. Use GetDynamicTensorShape instead of GetTensorShape");
79 throw std::runtime_error(
"TMVA SOFIE tensor [" +
name +
"] for which the shape is requested is not found");
84 return f->second.shape;
87 return f->second.shape;
97 return f->second.type;
101 return f2->second.type();
105 return f3->second.type;
109 return f4->second.type;
113 return f5->second.type;
119 throw std::runtime_error(
"TMVA SOFIE tensor [" +
name +
"] for which the type is requested is not found, model name: " +
fName);
135 throw std::runtime_error(
"TMVA-SOFIE: input tensor with name " +
input_name +
" already exists \n");
145 throw std::runtime_error(
"TMVA-SOFIE: input tensor with name " +
input_name +
" already exists \n");
157 auto libs =
op->GetStdLibs();
186 throw std::runtime_error(
"TMVA-SOFIE: initialized tensor with name " + tensor_name +
" already exists \n");
196 throw std::runtime_error(
"TMVA-SOFIE: initialized tensor with name " + tensor_name +
" already exists \n");
210 return itr->second.IsConstantTensor();
238 throw std::runtime_error(
"TMVA-SOFIE: intermediate tensor with name " + tensor_name +
" already exists \n");
247 throw std::runtime_error(
"TMVA-SOFIE: intermediate tensor with name " + tensor_name +
" already exists \n");
252 for (
auto &
d : shape) {
257 if (
d.dim !=
size_t(-1)) {
282 throw std::runtime_error(
"TMVA-SOFIE: tensor " + tensor_name +
" not found when trying to update it");
291 throw std::runtime_error(
"TMVA-SOFIE: tensor " + tensor_name +
" not found when trying to get its data");
293 return f->second.sharedptr();
300 throw std::runtime_error(
"TMVA-SOFIE: initialized tensor " + tensor_name +
" not found when trying to get its info");
302 t->second.SetNotWritable();
317 memory_allocation_string +=
"\n // Allocating memory for intermediate tensor " + std::string(it) +
" with size " + std::to_string(tensor_size) +
" bytes";
322 if (
chunk->second >= tensor_size) {
328 "* tensor_" + std::string(it) +
330 chunk->second -= tensor_size;
334 if (
chunk->second == 0) {
366 if (
chunk->second.tensor_name == it) {
388 chunk->second.tensor_size
415 std::cout <<
"Model is already initialized - skip initialization " << std::endl;
426 if (verbose) std::cout <<
"looking at the tensor " <<
input.first << std::endl;
429 for (
auto &
d :
input.second.shape) {
431 std::string
pname =
d.param;
437 std::cout <<
"Tensor: " <<
input.first <<
" - fix parametric shape " <<
itr->first <<
" to " <<
itr->second << std::endl;
447 if (!shape.empty()) {
459 for (
auto &
d :
input.second.shape) {
492 std::cout <<
"Initializing operator " << i <<
" " <<
typeid(
r).
name() << std::endl;
513 graph->fParentGraph =
this;
514 graph->fIsSubGraph =
true;
523 for (
auto &
e : graph->fNeededBlasRoutines)
526 for (
auto e : graph->fNeededStdLib)
531 graph->fInputTensorNames.emplace_back(
name);
543 std::stringstream
strs;
549 const T *
data = t.second.data<T>();
564 strs <<
"std::vector<" <<
type <<
"> fTensor_" << t.first <<
" = ";
570 strs <<
"const " <<
type <<
" * tensor_" + t.first +
" = fTensor_" + t.first +
".data();\n";
578 fGC +=
"// initialized tensors\n";
591 fGC +=
"std::vector<float> fTensor_" + i.first +
" = std::vector<float>(" + std::to_string(
length) +
");\n";
592 fGC +=
"float * tensor_" + i.first +
" = fTensor_" + i.first +
".data();\n";
600 fGC +=
"\n//--- Allocating session memory pool to be used for allocating intermediate tensors\n";
640 fGC +=
"//--- declare the dynamic tensors\n";
643 fGC +=
"std::vector<float> fTensor_" + i.first +
";\n";
644 fGC +=
"float * tensor_" + i.first +
" = nullptr;\n";
646 fGC +=
"std::vector<double> fTensor_" + i.first +
";\n";
647 fGC +=
"double * tensor_" + i.first +
" = nullptr;\n";
649 fGC +=
"std::vector<int64_t> fTensor_" + i.first +
";\n";
650 fGC +=
"int64_t * tensor_" + i.first +
" = nullptr;\n";
663 fGC +=
"\n//---- operator declarations \n";
669 fGC +=
"//---- allocate the intermediate dynamic tensors\n";
670 std::stringstream out;
673 out <<
SP <<
"if (" <<
length <<
" > 0) {\n";
674 out <<
SP <<
SP <<
"fTensor_" << i.first <<
".resize(" <<
length <<
");\n";
675 out <<
SP <<
SP <<
"tensor_" << i.first <<
" = fTensor_" << i.first <<
".data();\n";
691 for (
auto &
d : shape) {
692 std::string
pName =
d.param;
696 rGC +=
d.param +
",";
704 throw std::runtime_error(
"TMVA-SOFIE: input tensor " +
name +
705 " is of a data type which is not yet supported.");
719 std::cout <<
"Generating main inference code for " <<
fName << std::endl;
724 throw std::runtime_error(
"TMVA-SOFIE: output size=0 are not supported");
733 if (outputSize == 1) {
737 for (
size_t i = 1; i < outputSize; i++) {
745 for (
size_t i = 0; i < outputSize; i++) {
761 if (
fVerbose) std::cout <<
"Generating code for operator .... " <<
op_idx << std::endl;
765 if (outputSize == 1) {
775 fGC +=
SP +
"return ret;\n";
788 fGC +=
SP +
"return ret;\n";
796 for (
size_t i = 0; i < outputSize; i++) {
812 if (i < outputSize - 1)
819 fGC +=
SP +
"return ret;\n";
830 fGC +=
"struct Session {\n";
832 fGC +=
"struct Session_" +
fName +
" {\n";
867 fGC +=
"Session_" + graph->fName +
" fSession_" + graph->fName +
";\n";
877 for (
size_t id = 0;
id <
fOperators.size();
id++) {
878 std::string
opName = std::to_string(
id);
884 std::string fileName =
fName;
891 fGC +=
sessionName +
"(std::string filename =\"" + fileName +
"\"";
902 fGC +=
" size_t " +
p.first +
" = " +
p.second;
908 fGC +=
"\n//--- reading weights from file\n";
918 for (
size_t id = 0;
id <
fOperators.size();
id++) {
929 fGC +=
"}; // end of Session\n";
933void RModel::Generate(std::underlying_type_t<Options> options,
int batchSize,
long pos,
bool verbose)
953 throw std::runtime_error(
954 "TMVA-SOFIE: RModel::Generate: cannot use a separate weight file without generating a Session class");
957 if (
static_cast<std::underlying_type_t<Options>
>(
Options::kGNN) & options)
974 std::cout <<
"generate session code for subgraph " << graph->fName << std::endl;
975 graph->GenerateSessionCode();
980 std::cout <<
"generate Main session code - model " <<
fName << std::endl;
986 fGC += (
"} //TMVA_SOFIE_" +
fName +
"\n");
996 fGC +=
" std::ifstream f;\n";
997 fGC +=
" f.open(filename);\n";
998 fGC +=
" if (!f.is_open()) {\n";
999 fGC +=
" throw std::runtime_error(\"tmva-sofie failed to open file \" + filename + \" for input weights\");\n";
1003 fGC +=
" f.seekg(" + std::to_string(pos) +
");\n";
1006 fGC +=
" std::string tensor_name;\n";
1007 fGC +=
" size_t length;\n";
1012 if (!i.second.IsWeightTensor())
continue;
1013 std::string tensor_name =
"tensor_" + i.first;
1018 fGC +=
" f >> tensor_name >> length;\n";
1019 fGC +=
" if (tensor_name != \"" + tensor_name +
"\" ) {\n";
1020 fGC +=
" std::string err_msg = \"TMVA-SOFIE failed to read the correct tensor name; expected name is " +
1021 tensor_name +
" , read \" + tensor_name;\n";
1022 fGC +=
" throw std::runtime_error(err_msg);\n";
1024 fGC +=
" if (length != " +
slength +
") {\n";
1025 fGC +=
" std::string err_msg = \"TMVA-SOFIE failed to read the correct tensor size; expected size is " +
1026 slength +
" , read \" + std::to_string(length) ;\n";
1027 fGC +=
" throw std::runtime_error(err_msg);\n";
1029 fGC +=
" for (size_t i = 0; i < length; ++i)\n";
1030 fGC +=
" f >> " + tensor_name +
"[i];\n";
1031 fGC +=
" if (f.fail()) {\n";
1032 fGC +=
" throw std::runtime_error(\"TMVA-SOFIE failed to read the values for tensor " + tensor_name +
"\");\n";
1035 std::runtime_error(
"tmva-sofie tensor " + tensor_name +
" with type " +
ConvertTypeToString(i.second.type()) +
" cannot be read from a file");
1038 fGC +=
" f.close();\n";
1044 fGC +=
" std::unique_ptr<TFile> rootFile(TFile::Open(filename.c_str(), \"READ\"));\n";
1045 fGC +=
" if (!rootFile->IsOpen()) {\n";
1046 fGC +=
" throw std::runtime_error(\"tmva-sofie failed to open ROOT file for input weights\");\n";
1050 fGC +=
" if (!rootFile->GetKey(\"" +
dirName +
"\")) {\n";
1051 fGC +=
" throw std::runtime_error(\"tmva-sofie failed to open ROOT directory for input weights\");\n";
1056 if (!i.second.IsWeightTensor())
continue;
1058 std::string tensor_name =
"tensor_" + i.first;
1060 fGC +=
" fTensor_" + i.first +
" = *reinterpret_cast<std::vector<float>*>(rootFile->Get(\"";
1061 fGC +=
dirName +
"/" + tensor_name +
"\"));\n";
1063 fGC +=
" fTensor_" + i.first +
" = *reinterpret_cast<std::vector<double>*>(rootFile->Get(\"";
1064 fGC +=
dirName + +
"/" + tensor_name +
"\"));\n";
1066 fGC +=
" fTensor_" + i.first +
" = *reinterpret_cast<std::vector<int64_t>*>(rootFile->Get(\"";
1067 fGC +=
dirName +
"/" + tensor_name +
"\"));\n";
1069 std::runtime_error(
"tmva-sofie tensor " + tensor_name +
" with type " +
ConvertTypeToString(i.second.type()) +
" cannot be read from a ROOT file");
1100 throw std::runtime_error(
"SOFIE-GNN yet not supports writing to a ROOT file.");
1113 if (!item.second.IsWeightTensor())
continue;
1114 std::string
tensorName =
"tensor_" + item.first;
1118 const float*
data = item.second.data<
float>();
1123 const double*
data = item.second.data<
double>();
1128 const int64_t*
data = item.second.data<int64_t>();
1134 " cannot be written to a ROOT file");
1152 std::runtime_error(
"tmva-sofie failed to open file " +
filename +
" for tensor weight data");
1155 if (!i.second.IsWeightTensor()) {
1159 std::string tensor_name =
"tensor_" + i.first;
1160 f << tensor_name <<
" " <<
length <<
"\n";
1162 const float *
data = i.second.data<
float>();
1163 for (
size_t idx = 0; idx <
length; idx++) {
1166 if (
value != 0. && std::abs(
value) < std::numeric_limits<float>::min() )
value = 0;
1167 f << std::setprecision(std::numeric_limits<float>::max_digits10) <<
value;
1168 f << ( (idx <
length-1) ?
" " :
"\n" );
1172 std::runtime_error(
"tmva-sofie tensor " + tensor_name +
" with type " +
ConvertTypeToString(i.second.type()) +
" cannot be written to a file");
1175 std::runtime_error(
"tmva-sofie failed to write tensor data to file for " + tensor_name);
1186 std::cout <<
"Model requires following inputs:\n";
1188 std::cout <<
"Parametrised Tensor name: " <<
inputInfo.first <<
"\t";
1190 std::cout <<
"shape: [";
1191 for (
size_t i = 0; i <
inputInfo.second.shape.size(); i++) {
1192 if (
inputInfo.second.shape[i].isParam) {
1193 std::cout <<
inputInfo.second.shape[i].param;
1195 std::cout <<
inputInfo.second.shape[i].dim ;
1197 if (i <
inputInfo.second.shape.size() - 1) std::cout <<
",";
1199 std::cout <<
"]" << std::endl;
1203 std::cout <<
"Fully Specified Tensor name: " <<
inputInfo.first <<
"\t";
1205 std::cout <<
"shape: [";
1206 for (
size_t i = 0; i <
inputInfo.second.shape.size(); i++) {
1208 if (i <
inputInfo.second.shape.size() - 1) std::cout <<
",";
1210 std::cout <<
"]" << std::endl;
1216 std::cout <<
"Model initialized the following tensors:\n";
1218 std::cout <<
"Tensor name: \"" << it.first <<
"\"\t";
1220 std::cout <<
"shape: [";
1221 for (
size_t i = 0; i < it.second.shape().
size(); i++) {
1222 std::cout << it.second.shape()[i];
1223 if (i < it.second.shape().size() - 1) std::cout <<
",";
1226 if (it.second.IsConstantTensor()) std::cout <<
" (Constant)";
1227 else if (!it.second.IsWeightTensor()) std::cout <<
" (Not Writable)";
1228 std::cout << std::endl;
1234 std::cout <<
"Model specify the following intermediate tensors:\n";
1236 std::cout <<
"Tensor name: \"" << it.first <<
"\"\t";
1238 std::cout <<
"shape: [";
1239 for (
size_t i = 0; i < it.second.shape.size(); i++) {
1240 std::cout << it.second.shape[i];
1241 if (i < it.second.shape.size() - 1) std::cout <<
",";
1243 std::cout <<
"]" << std::endl;
1249 std::cout <<
"Model specify the following dynamic tensors:\n";
1251 std::cout <<
"Tensor name: \"" << it.first <<
"\"\t";
1253 std::cout <<
"shape: [";
1254 for (
size_t i = 0; i < it.second.shape.size(); i++) {
1255 std::cout << it.second.shape[i].GetVal();
1256 if (i < it.second.shape.size() - 1) std::cout <<
",";
1258 std::cout <<
"]" << std::endl;
1264 std::cout <<
"Model specify the following output tensors:\n";
1266 std::cout <<
"Tensor name: \"" << it <<
"\"\t";
1278 std::cout <<
"Tensor " <<
name <<
" not found in model's initialized tensor list" << std::endl;
1282 std::cout <<
"Tensor name: " << it->first <<
"\t";
1285 std::cout <<
"shape: [";
1286 for (
size_t i = 0; i < it->second.shape().
size(); i++) {
1287 std::cout << it->second.shape()[i];
1288 length *= it->second.shape()[i];
1289 if (
i < it->second.shape().size() - 1) std::cout <<
",";
1291 std::cout <<
"]" << std::endl;
1298 std::cout <<
"data: [" << std::endl;
1301 for (
int i =0; i <
n_print; i++) {
1303 if (i <
n_print - 1) std::cout <<
" ,";
1306 if (
ellipsis) std::cout <<
", ...";
1307 std::cout <<
"]" << std::endl;
1318 size_t pos =
filename.find(
".hxx");
1334 if (
R__b.IsReading()) {
1335 RModel::Class()->ReadBuffer(
R__b,
this);
1337 i->second.CastPersistentToShared();
1342 i->second.CastSharedToPersistent();
1344 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)
std::unordered_set< std::string > fNeededBlasRoutines
void OutputGenerated(std::string filename="", bool append=false)
std::unordered_set< std::string > fNeededStdLib
WeightFileType fWeightFile
void AddBlasRoutines(std::vector< std::string > routines)
void AddNeededStdLib(std::string libname)
const ETensorType & GetTensorType(std::string name)
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()
std::vector< Dim > GetDynamicTensorShape(std::string name)
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)
RModel & operator=(RModel &&other)
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
void GenerateSessionCode()
bool IsDimInputTensor(const std::string &name) const
void GenerateDynamicTensorInfo()
bool IsInitializedTensor(const 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)
RModel()=default
Default constructor.
void HeadInitializedTensors(std::string name, int n_print=50)
bool IsConstantTensor(const std::string &name) const
void Initialize(int batchSize=-1, bool verbose=false)
const std::vector< size_t > & GetTensorShape(std::string name)
long WriteInitializedTensorsToFile(std::string filename="")
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)
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