Commit ee091851 authored by Davis King's avatar Davis King

Fixed a slow memory leak that occurred when using cuDNN and tensors were created.

parent 84cd330c
...@@ -190,16 +190,14 @@ namespace dlib ...@@ -190,16 +190,14 @@ namespace dlib
int nr, int nr,
int nc int nc
) )
{
if (n == 0 || nr == 0 || nc == 0 || k == 0)
{ {
if (handle) if (handle)
{ {
cudnnDestroyTensorDescriptor((cudnnTensorDescriptor_t)handle); cudnnDestroyTensorDescriptor((cudnnTensorDescriptor_t)handle);
handle = nullptr; handle = nullptr;
} }
}
else if (n != 0 && nr != 0 && nc != 0 && k != 0)
{ {
cudnnTensorDescriptor_t h; cudnnTensorDescriptor_t h;
CHECK_CUDNN(cudnnCreateTensorDescriptor(&h)); CHECK_CUDNN(cudnnCreateTensorDescriptor(&h));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment