@@ -262,7 +262,8 @@ void RModel::Initialize(int batchSize, bool verbose) {
262
262
// loop on inputs and see if shape can be full specified
263
263
// if the batch size is provided it can be used to specify the full shape
264
264
// Add the full specified tensors in fReadyInputTensors collection
265
- for (auto &input : fInputTensorInfos ) {
265
+ auto originalInputTensorInfos = fInputTensorInfos ; // need to copy because we may delete elements
266
+ for (auto &input : originalInputTensorInfos) {
266
267
std::cout << " looking at the tensor " << input.first << std::endl;
267
268
// if a batch size is provided convert batch size
268
269
// assume is parametrized as "bs" or "batch_size"
@@ -288,12 +289,10 @@ void RModel::Initialize(int batchSize, bool verbose) {
288
289
}
289
290
auto shape = ConvertShapeToInt (input.second .shape );
290
291
if (!shape.empty ()) {
291
- #if 0
292
292
// remove from the tensor info old dynamic shape
293
293
fInputTensorInfos .erase (input.first );
294
294
// add to the ready input tensor information the new fixed shape
295
- AddInputTensorInfo(input.first, input.second.type, shape);
296
- #endif
295
+ AddInputTensorInfo (input.first , input.second .type , shape);
297
296
}
298
297
// store the parameters of the input tensors
299
298
else {
@@ -647,7 +646,7 @@ void RModel::ReadInitializedTensorsFromFile(long pos) {
647
646
fGC += " std::ifstream f;\n " ;
648
647
fGC += " f.open(filename);\n " ;
649
648
fGC += " if (!f.is_open()) {\n " ;
650
- fGC += " throw std::runtime_error(\" tmva-sofie failed to open file for input weights\" );\n " ;
649
+ fGC += " throw std::runtime_error(\" tmva-sofie failed to open file \" + filename + \" for input weights\" );\n " ;
651
650
fGC += " }\n " ;
652
651
653
652
if (fIsGNNComponent ) {
@@ -783,7 +782,7 @@ long RModel::WriteInitializedTensorsToFile(std::string filename) {
783
782
}
784
783
if (!f.is_open ())
785
784
throw
786
- std::runtime_error (" tmva-sofie failed to open file for tensor weight data" );
785
+ std::runtime_error (" tmva-sofie failed to open file " + filename + " for tensor weight data" );
787
786
for (auto & i: fInitializedTensors ) {
788
787
if (i.second .type () == ETensorType::FLOAT) {
789
788
size_t length = 1 ;
0 commit comments