From 7e3495f809475d98ad40b05f89e2a4790a14965a Mon Sep 17 00:00:00 2001 From: reminisce Date: Thu, 25 May 2017 20:46:13 -0700 Subject: [PATCH] Fix cudnn_deconv not guarding no_bias --- src/operator/cudnn_deconvolution-inl.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/operator/cudnn_deconvolution-inl.h b/src/operator/cudnn_deconvolution-inl.h index 8405c2399897..99426531beb0 100644 --- a/src/operator/cudnn_deconvolution-inl.h +++ b/src/operator/cudnn_deconvolution-inl.h @@ -217,15 +217,19 @@ class CuDNNDeconvolutionOp : public Operator { gdata_ptr = gdata.dptr_; } CHECK_NE(req[deconv::kWeight], kWriteInplace); - CHECK_NE(req[deconv::kBias], kWriteInplace); + if (!param_.no_bias) { + CHECK_NE(req[deconv::kBias], kWriteInplace); + } CHECK_NE(req[deconv::kData], kWriteInplace); Tensor workspace = ctx.requested[deconv::kTempSpace].get_space_typed( mshadow::Shape1(backward_workspace_), s); for (uint32_t g = 0; g < param_.num_group; ++g) { typename DataType::ScaleType alpha = 1.0f; - typename DataType::ScaleType bias_beta = - req[deconv::kBias] == kAddTo ? 1.0f : 0.0f; + typename DataType::ScaleType bias_beta = 0.0f; + if (!param_.no_bias && req[deconv::kBias] == kAddTo) { + bias_beta = 1.0f; + } typename DataType::ScaleType data_beta = req[deconv::kData] == kAddTo ? 1.0f : 0.0f; typename DataType::ScaleType weight_beta =