From 70678e44ae1293227939979e02a978200d0bd493 Mon Sep 17 00:00:00 2001 From: alexander-g <3867427+alexander-g@users.noreply.github.com> Date: Thu, 11 Mar 2021 20:08:18 +0100 Subject: [PATCH 1/2] too many warnings --- src/Sequence.cpp | 6 ++++-- src/Tensor.cpp | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Sequence.cpp b/src/Sequence.cpp index 4db458288..cc54acc8b 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -27,7 +27,8 @@ Sequence::~Sequence() { KP_LOG_DEBUG("Kompute Sequence Destructor started"); - this->destroy(); + if (this->mDevice) + this->destroy(); } void @@ -81,7 +82,8 @@ void Sequence::clear() { KP_LOG_DEBUG("Kompute Sequence calling clear"); - this->end(); + if (this->isRecording()) + this->end(); } std::shared_ptr diff --git a/src/Tensor.cpp b/src/Tensor.cpp index 90c21fc8a..0a16702d4 100644 --- a/src/Tensor.cpp +++ b/src/Tensor.cpp @@ -28,7 +28,8 @@ Tensor::~Tensor() KP_LOG_DEBUG("Kompute Tensor destructor started. Type: {}", this->tensorType()); - this->destroy(); + if (this->mDevice) + this->destroy(); KP_LOG_DEBUG("Kompute Tensor destructor success"); } From c6c89ac75af216449b206558c2da72341521c38e Mon Sep 17 00:00:00 2001 From: alexander-g <3867427+alexander-g@users.noreply.github.com> Date: Thu, 11 Mar 2021 20:30:30 +0100 Subject: [PATCH 2/2] { } --- src/Sequence.cpp | 6 ++++-- src/Tensor.cpp | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Sequence.cpp b/src/Sequence.cpp index cc54acc8b..501e965d0 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -27,8 +27,9 @@ Sequence::~Sequence() { KP_LOG_DEBUG("Kompute Sequence Destructor started"); - if (this->mDevice) + if (this->mDevice) { this->destroy(); + } } void @@ -82,8 +83,9 @@ void Sequence::clear() { KP_LOG_DEBUG("Kompute Sequence calling clear"); - if (this->isRecording()) + if (this->isRecording()) { this->end(); + } } std::shared_ptr diff --git a/src/Tensor.cpp b/src/Tensor.cpp index 0a16702d4..a7b433a74 100644 --- a/src/Tensor.cpp +++ b/src/Tensor.cpp @@ -28,8 +28,9 @@ Tensor::~Tensor() KP_LOG_DEBUG("Kompute Tensor destructor started. Type: {}", this->tensorType()); - if (this->mDevice) + if (this->mDevice) { this->destroy(); + } KP_LOG_DEBUG("Kompute Tensor destructor success"); }