From b45ce925428efce1008b40adb9603cfb57500306 Mon Sep 17 00:00:00 2001 From: Hariharan Seshadri Date: Wed, 6 May 2020 00:05:15 -0700 Subject: [PATCH] Fix 3828 (#3837) --- onnxruntime/core/providers/cuda/nn/conv.cc | 56 +++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/onnxruntime/core/providers/cuda/nn/conv.cc b/onnxruntime/core/providers/cuda/nn/conv.cc index 68b551a820..f7004ee2be 100644 --- a/onnxruntime/core/providers/cuda/nn/conv.cc +++ b/onnxruntime/core/providers/cuda/nn/conv.cc @@ -166,40 +166,40 @@ Status Conv::ComputeInternal(OpKernelContext* context) const { s_.algo = perf.algo; s_.workspace_bytes = perf.memory; } - } - if (!y_data) { - Tensor* Y = context->Output(0, TensorShape(s_.y_dims)); - // special case when there is a dim value of 0 in the shape. - if (Y->Shape().Size() == 0) - return Status::OK(); + if (!y_data) { + Tensor* Y = context->Output(0, TensorShape(s_.y_dims)); + // special case when there is a dim value of 0 in the shape. + if (Y->Shape().Size() == 0) + return Status::OK(); - y_data = reinterpret_cast(Y->template MutableData()); - } + y_data = reinterpret_cast(Y->template MutableData()); + } - const auto alpha = Consts::One; - const auto beta = Consts::Zero; + const auto alpha = Consts::One; + const auto beta = Consts::Zero; - IAllocatorUniquePtr workspace = GetScratchBuffer(s_.workspace_bytes); + IAllocatorUniquePtr workspace = GetScratchBuffer(s_.workspace_bytes); - CUDNN_RETURN_IF_ERROR(cudnnConvolutionForward(CudnnHandle(), - &alpha, - s_.x_tensor, - x_data, - s_.filter_desc, - w_data, - s_.conv_desc, - s_.algo, - workspace.get(), - s_.workspace_bytes, - &beta, - s_.y_tensor, - y_data)); + CUDNN_RETURN_IF_ERROR(cudnnConvolutionForward(CudnnHandle(), + &alpha, + s_.x_tensor, + x_data, + s_.filter_desc, + w_data, + s_.conv_desc, + s_.algo, + workspace.get(), + s_.workspace_bytes, + &beta, + s_.y_tensor, + y_data)); - if (has_bias) { - const Tensor* B = context->Input(2); - auto b_data = reinterpret_cast(B->template Data()); - CUDNN_RETURN_IF_ERROR(cudnnAddTensor(CudnnHandle(), &alpha, s_.b_tensor, b_data, &alpha, s_.y_tensor, y_data)); + if (has_bias) { + const Tensor* B = context->Input(2); + auto b_data = reinterpret_cast(B->template Data()); + CUDNN_RETURN_IF_ERROR(cudnnAddTensor(CudnnHandle(), &alpha, s_.b_tensor, b_data, &alpha, s_.y_tensor, y_data)); + } } return Status::OK();