Skip to content

Commit 2e03ec9

Browse files
committed
Clearing data structures for multiple calls
1 parent ab4383e commit 2e03ec9

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

MLModelRunner/PTModelRunner/PTModelRunner.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ namespace MLBridge
5555
static_cast<TensorVec*>(this->SerDes->getRequest())->push_back(seq_lens);
5656
auto outputs = static_cast<torch::inductor::AOTIModelContainerRunnerCpu*>(this->CompiledModel)->run((*static_cast<TensorVec*>(this->SerDes->getRequest())));
5757

58+
(*(outputTensors)).clear();
5859
for (auto i = outputs.begin(); i != outputs.end(); ++i)
5960
(*(outputTensors)).push_back(*i);
6061
void *rawData = this->SerDes->deserializeUntyped(outputTensors);

SerDes/pytorchSerDes/pytorchSerDes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ void PytorchSerDes::cleanDataStructures() {
102102
}
103103

104104
void *PytorchSerDes::deserializeUntyped(void *Data) {
105+
cleanDataStructures();
105106
if (Data == nullptr) {
106107
return nullptr;
107108
}

0 commit comments

Comments
 (0)