Skip to content

Commit 53b7f7a

Browse files
committed
making memory cleaning more explicit
1 parent 42da428 commit 53b7f7a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

deep_core/src/tensor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ Tensor::Tensor(Tensor && other) noexcept
173173
other.is_owner_ = false;
174174
other.byte_size_ = 0;
175175
other.allocator_ = nullptr;
176+
other.shape_.clear();
177+
other.strides_.clear();
176178
}
177179

178180
Tensor & Tensor::operator=(Tensor && other) noexcept
@@ -192,6 +194,8 @@ Tensor & Tensor::operator=(Tensor && other) noexcept
192194
other.is_owner_ = false;
193195
other.byte_size_ = 0;
194196
other.allocator_ = nullptr;
197+
other.shape_.clear();
198+
other.strides_.clear();
195199
}
196200
return *this;
197201
}

0 commit comments

Comments
 (0)