Skip to content

Commit

Permalink
Merge pull request #134 from EthicalML/fix_destroy_staging_tensors
Browse files Browse the repository at this point in the history
Added destructor for staging tensors
  • Loading branch information
axsaucedo authored Feb 7, 2021
2 parents df5477a + 71f0933 commit 373ecd0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/OpTensorCreate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ OpTensorCreate::OpTensorCreate(
OpTensorCreate::~OpTensorCreate()
{
SPDLOG_DEBUG("Kompute OpTensorCreate destructor started");

SPDLOG_DEBUG("Kompute OpTensorCreate freeing staging tensors");
for (std::shared_ptr<Tensor> tensor : this->mStagingTensors) {
if (tensor && tensor->isInit()) {
tensor->freeMemoryDestroyGPUResources();
} else {
SPDLOG_ERROR("Kompute OpTensorCreate expected to free "
"tensor but has already been freed.");
}
}
}

void
Expand Down

0 comments on commit 373ecd0

Please sign in to comment.