Merge pull request #134 from EthicalML/fix_destroy_staging_tensors

Added destructor for staging tensors
This commit is contained in:
Alejandro Saucedo 2021-02-07 08:43:43 +00:00 committed by GitHub
commit 373ecd0185
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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