diff options
author | 2018-05-15 13:38:34 -0700 | |
---|---|---|
committer | 2018-05-15 13:40:56 -0700 | |
commit | 12ea999991f53a4d1cecdd1816bfceff6da13ae4 (patch) | |
tree | c98ca1d5b40f0404b595558e59791a33931bac53 /tensorflow | |
parent | 4d91734ca1e400a7fef012e75d2590377583261c (diff) |
Don't ever use cuDNN to perform depthwise convolutions on CPU.
PiperOrigin-RevId: 196721302
Diffstat (limited to 'tensorflow')
-rw-r--r-- | tensorflow/core/kernels/depthwise_conv_grad_op.cc | 4 | ||||
-rw-r--r-- | tensorflow/core/kernels/depthwise_conv_op.cc | 2 | ||||
-rw-r--r-- | tensorflow/python/kernel_tests/depthwise_conv_op_test.py | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/tensorflow/core/kernels/depthwise_conv_grad_op.cc b/tensorflow/core/kernels/depthwise_conv_grad_op.cc index 42a4832910..da3bdb475e 100644 --- a/tensorflow/core/kernels/depthwise_conv_grad_op.cc +++ b/tensorflow/core/kernels/depthwise_conv_grad_op.cc @@ -564,7 +564,7 @@ class DepthwiseConv2dNativeBackpropInputOp : public OpKernel { OP_REQUIRES_OK(context, context->GetAttr("padding", &padding_)); // For in_depth == 1 and grouped convolutions. - use_cudnn_ = CanUseCudnn(); + use_cudnn_ = CanUseCudnn() && std::is_same<Device, GPUDevice>::value; cudnn_use_autotune_ = CudnnUseAutotune(); use_cudnn_grouped_conv_ = false; dtype_ = DataTypeToEnum<T>::value; @@ -1037,7 +1037,7 @@ class DepthwiseConv2dNativeBackpropFilterOp : public OpKernel { OP_REQUIRES_OK(context, context->GetAttr("padding", &padding_)); // For in_depth == 1 and grouped convolutions. - use_cudnn_ = CanUseCudnn(); + use_cudnn_ = CanUseCudnn() && std::is_same<Device, GPUDevice>::value; cudnn_use_autotune_ = CudnnUseAutotune(); use_cudnn_grouped_conv_ = false; diff --git a/tensorflow/core/kernels/depthwise_conv_op.cc b/tensorflow/core/kernels/depthwise_conv_op.cc index d5f4a68120..f0902fdba6 100644 --- a/tensorflow/core/kernels/depthwise_conv_op.cc +++ b/tensorflow/core/kernels/depthwise_conv_op.cc @@ -290,7 +290,7 @@ class DepthwiseConv2dNativeOp : public BinaryOp<T> { OP_REQUIRES_OK(context, context->GetAttr("padding", &padding_)); // For in_depth == 1 and grouped convolutions. - use_cudnn_ = CanUseCudnn(); + use_cudnn_ = CanUseCudnn() && std::is_same<Device, GPUDevice>::value; cudnn_use_autotune_ = CudnnUseAutotune(); use_cudnn_grouped_conv_ = false; dtype_ = DataTypeToEnum<T>::value; diff --git a/tensorflow/python/kernel_tests/depthwise_conv_op_test.py b/tensorflow/python/kernel_tests/depthwise_conv_op_test.py index 659dc0419a..5e223b1828 100644 --- a/tensorflow/python/kernel_tests/depthwise_conv_op_test.py +++ b/tensorflow/python/kernel_tests/depthwise_conv_op_test.py @@ -355,7 +355,7 @@ class DepthwiseConv2DTest(test.TestCase): graph = ops.get_default_graph() with self.test_session(graph=graph, use_gpu=use_gpu) as sess: tolerance = { - dtypes.float16: 2e-0, + dtypes.float16: 4e-0, dtypes.float32: 5e-4, dtypes.float64: 1e-12, }[data_type] |