提交 c5aab228 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #3137 from abergeron/fix_memleak_dnn

Fix memory leak of descriptors in cudnn bindings.
......@@ -630,7 +630,7 @@ if (py_%(name)s == NULL) { %(freefunc)s(%(name)s); }
return ""
def c_code_cache_version(self):
return (2,)
return (2, self.ctype, self.freefunc)
def __str__(self):
return "%s{%s}" % (self.__class__.__name__, self.ctype)
......
......@@ -256,7 +256,8 @@ class GpuDnnConvDesc(GpuOp):
raise TypeError('kern must be 1D shape tensor')
return Apply(self, [img_shape, kern_shape],
[CDataType("cudnnConvolutionDescriptor_t")()])
[CDataType("cudnnConvolutionDescriptor_t",
freefunc="cudnnDestroyConvolutionDescriptor")()])
def c_code(self, node, name, inputs, outputs, sub):
img_shape, kern_shape = inputs
......@@ -773,7 +774,8 @@ class GpuDnnPoolDesc(GpuOp):
raise RuntimeError("CuDNN pooling with padding requires CuDNN v2")
return Apply(self, [],
[CDataType("cudnnPoolingDescriptor_t")()])
[CDataType("cudnnPoolingDescriptor_t",
freefunc="cudnnDestroyPoolingDescriptor")()])
def c_code(self, node, name, inputs, outputs, sub):
desc, = outputs
......
......@@ -294,7 +294,8 @@ class GpuDnnConvDesc(Op):
raise TypeError('kern must be 1D shape tensor')
return Apply(self, [img_shape, kern_shape],
[CDataType("cudnnConvolutionDescriptor_t")()])
[CDataType("cudnnConvolutionDescriptor_t",
freefunc="cudnnDestroyConvolutionDescriptor")()])
def c_code(self, node, name, inputs, outputs, sub):
img_shape, kern_shape = inputs
......@@ -794,7 +795,8 @@ class GpuDnnPoolDesc(Op):
raise RuntimeError("CuDNN pooling with padding requires CuDNN v2")
return Apply(self, [],
[CDataType("cudnnPoolingDescriptor_t")()])
[CDataType("cudnnPoolingDescriptor_t",
freefunc="cudnnDestroyPoolingDescriptor")()])
def c_code(self, node, name, inputs, outputs, sub):
desc, = outputs
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论