提交 6a638446 authored 作者: --global's avatar --global

Restrict conv2d special case to CuDNN v1

上级 e9dcf6de
...@@ -996,10 +996,11 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1), ...@@ -996,10 +996,11 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1),
return as_cuda_ndarray_variable(conv.dimshuffle(1, 0, 2, 3)) return as_cuda_ndarray_variable(conv.dimshuffle(1, 0, 2, 3))
elif (border_mode == 'full' and subsample == (1, 1) and elif (border_mode == 'full' and subsample == (1, 1) and
direction_hint != 'forward!'): direction_hint != 'forward!' and version() == -1):
# Special case: We can be faster by using GpuDnnConvGradI to compute # Special case: In CuDNN v1, we can be faster by using GpuDnnConvGradI
# the full convolution as the backward pass of a valid convolution. # to compute the full convolution as the backward pass of a valid
# We just need to set up a suitable 'fake' valid convolution. # convolution. We just need to set up a suitable 'fake' valid
# convolution.
img = gpu_contiguous(img) # cudnn v1 and v2 rc3 need contiguous data img = gpu_contiguous(img) # cudnn v1 and v2 rc3 need contiguous data
kerns = gpu_contiguous(kerns.dimshuffle(1, 0, 2, 3)) kerns = gpu_contiguous(kerns.dimshuffle(1, 0, 2, 3))
conv_mode = 'cross' if conv_mode == 'conv' else 'conv' conv_mode = 'cross' if conv_mode == 'conv' else 'conv'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论