提交 f748cf87 authored 作者: Nicolas Ballas's avatar Nicolas Ballas 提交者: --global

fix rebase issues

上级 822c06d4
...@@ -374,7 +374,7 @@ class GpuDnnConvDesc(GpuOp): ...@@ -374,7 +374,7 @@ class GpuDnnConvDesc(GpuOp):
AddConfigVar('dnn.conv.workmem', AddConfigVar('dnn.conv.workmem',
"Default value for the workmem attribute of cudnn convolutions.", "Default value for the workmem attribute of cudnn convolutions.",
EnumStr('small', 'none', 'large', 'fft', 'guess', 'time'), EnumStr('none', 'small', 'large', 'fft', 'guess', 'time'),
in_c_key=False) in_c_key=False)
AddConfigVar('dnn.conv.workmem_bwd', AddConfigVar('dnn.conv.workmem_bwd',
...@@ -713,11 +713,11 @@ class GpuDnnConv3d(GpuDnnConv): ...@@ -713,11 +713,11 @@ class GpuDnnConv3d(GpuDnnConv):
def __init__(self, workmem=None, inplace=False): def __init__(self, workmem=None, inplace=False):
""" """
:param workmem: either 'none' 'time' or 'guess'. :param workmem: either 'none', 'time' or 'guess'.
Default is the value of :attr:`config.dnn.conv.workmem`. Default is the value of :attr:`config.dnn.conv.workmem`.
""" """
super(GpuDnnConv3d, self).__init__(workmem='guess', inplace=inplace) super(GpuDnnConv3d, self).__init__(workmem='guess', inplace=inplace)
assert self.workmem in ['none' 'time','guess'] assert self.workmem in ['none', 'time','guess']
def make_node(self, img, kern, output, desc, alpha=None, beta=None, nb_dim=None): def make_node(self, img, kern, output, desc, alpha=None, beta=None, nb_dim=None):
...@@ -907,8 +907,8 @@ class GpuDnnConv3dGradW(GpuDnnConvGradW): ...@@ -907,8 +907,8 @@ class GpuDnnConv3dGradW(GpuDnnConvGradW):
__input_name__ = ('image', 'grad', 'output', 'descriptor', 'alpha', 'beta') __input_name__ = ('image', 'grad', 'output', 'descriptor', 'alpha', 'beta')
def __init__(self, inplace=False, workmem=None): def __init__(self, inplace=False, workmem=None):
### Only workmem = 'none' work with cudnn conv 3d
super(GpuDnnConv3dGradW, self).__init__(inplace=inplace, workmem='none') super(GpuDnnConv3dGradW, self).__init__(inplace=inplace, workmem='none')
assert self.workmem in ['none', 'time','guess']
def grad(self, inp, grads): def grad(self, inp, grads):
img, top, output, desc, alpha, beta, nb_dim = inp img, top, output, desc, alpha, beta, nb_dim = inp
...@@ -1064,8 +1064,9 @@ class GpuDnnConv3dGradI(GpuDnnConvGradI): ...@@ -1064,8 +1064,9 @@ class GpuDnnConv3dGradI(GpuDnnConvGradI):
__input_name__ = ('kernel', 'grad', 'output', __input_name__ = ('kernel', 'grad', 'output',
'descriptor', 'alpha', 'beta') 'descriptor', 'alpha', 'beta')
def __init__(self, inplace=False): def __init__(self, inplace=False, workmem=None):
super(GpuDnnConv3dGradI, self).__init__(inplace) super(GpuDnnConv3dGradI, self).__init__(inplace, workmem)
assert self.workmem in ['none', 'time','guess']
def grad(self, inp, grads): def grad(self, inp, grads):
......
...@@ -41,11 +41,11 @@ APPLY_SPECIFIC(conv_gi)(CudaNdarray *kerns, CudaNdarray *output, ...@@ -41,11 +41,11 @@ APPLY_SPECIFIC(conv_gi)(CudaNdarray *kerns, CudaNdarray *output,
// Check if the kernels and the output have the same shape as they have // Check if the kernels and the output have the same shape as they have
// last time the apply node was executed // last time the apply node was executed
bool same_shapes = true; bool same_shapes = true;
for (int i = 0; (i < 4) && same_shapes; i++) for (int i = 0; (i < nb_dim) && same_shapes; i++)
{ {
same_shapes &= (CudaNdarray_HOST_DIMS(kerns)[i] != same_shapes &= (CudaNdarray_HOST_DIMS(kerns)[i] ==
APPLY_SPECIFIC(previous_kerns_shape)[i]); APPLY_SPECIFIC(previous_kerns_shape)[i]);
same_shapes &= (CudaNdarray_HOST_DIMS(output)[i] != same_shapes &= (CudaNdarray_HOST_DIMS(output)[i] ==
APPLY_SPECIFIC(previous_output_shape)[i]); APPLY_SPECIFIC(previous_output_shape)[i]);
} }
...@@ -86,7 +86,7 @@ APPLY_SPECIFIC(conv_gi)(CudaNdarray *kerns, CudaNdarray *output, ...@@ -86,7 +86,7 @@ APPLY_SPECIFIC(conv_gi)(CudaNdarray *kerns, CudaNdarray *output,
// Store the shapes of the kernels and output as well as the chosen // Store the shapes of the kernels and output as well as the chosen
// algorithm for future use. // algorithm for future use.
APPLY_SPECIFIC(previous_bwd_d_algo) = chosen_algo; APPLY_SPECIFIC(previous_bwd_d_algo) = chosen_algo;
for (int i = 0; i < 4; i++) for (int i = 0; i < nb_dim; i++)
{ {
APPLY_SPECIFIC(previous_kerns_shape)[i] = APPLY_SPECIFIC(previous_kerns_shape)[i] =
CudaNdarray_HOST_DIMS(kerns)[i]; CudaNdarray_HOST_DIMS(kerns)[i];
...@@ -113,7 +113,7 @@ APPLY_SPECIFIC(conv_gi)(CudaNdarray *kerns, CudaNdarray *output, ...@@ -113,7 +113,7 @@ APPLY_SPECIFIC(conv_gi)(CudaNdarray *kerns, CudaNdarray *output,
// If the chosen implementation is FFT, validate that it can be used // If the chosen implementation is FFT, validate that it can be used
// on the current data and default on a safe implementation if it // on the current data and default on a safe implementation if it
// can't. // can't.
if (chosen_algo == CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT) if (chosen_algo == CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT && nb_dim == 4)
{ {
// Extract the properties of the convolution descriptor // Extract the properties of the convolution descriptor
......
...@@ -113,7 +113,7 @@ APPLY_SPECIFIC(conv_gw)(CudaNdarray *input, CudaNdarray *output, ...@@ -113,7 +113,7 @@ APPLY_SPECIFIC(conv_gw)(CudaNdarray *input, CudaNdarray *output,
// If the chosen implementation is FFT, validate that it can be used // If the chosen implementation is FFT, validate that it can be used
// on the current data and default on a safe implementation if it // on the current data and default on a safe implementation if it
// can't. // can't.
if (chosen_algo == CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT) if (chosen_algo == CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT && nb_dim == 4)
{ {
// Extract the properties of the convolution descriptor // Extract the properties of the convolution descriptor
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论