提交 aa318b5d authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix memory leak of descriptors in cudnn bindings.

上级 a1783c0b
...@@ -256,7 +256,8 @@ class GpuDnnConvDesc(GpuOp): ...@@ -256,7 +256,8 @@ class GpuDnnConvDesc(GpuOp):
raise TypeError('kern must be 1D shape tensor') raise TypeError('kern must be 1D shape tensor')
return Apply(self, [img_shape, kern_shape], return Apply(self, [img_shape, kern_shape],
[CDataType("cudnnConvolutionDescriptor_t")()]) [CDataType("cudnnConvolutionDescriptor_t",
freefunc="cudnnDestroyConvolutionDescriptor")()])
def c_code(self, node, name, inputs, outputs, sub): def c_code(self, node, name, inputs, outputs, sub):
img_shape, kern_shape = inputs img_shape, kern_shape = inputs
...@@ -773,7 +774,8 @@ class GpuDnnPoolDesc(GpuOp): ...@@ -773,7 +774,8 @@ class GpuDnnPoolDesc(GpuOp):
raise RuntimeError("CuDNN pooling with padding requires CuDNN v2") raise RuntimeError("CuDNN pooling with padding requires CuDNN v2")
return Apply(self, [], return Apply(self, [],
[CDataType("cudnnPoolingDescriptor_t")()]) [CDataType("cudnnPoolingDescriptor_t",
freefunc="cudnnDestroyPoolingDescriptor")()])
def c_code(self, node, name, inputs, outputs, sub): def c_code(self, node, name, inputs, outputs, sub):
desc, = outputs desc, = outputs
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论