Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Avoids running unneeded backprop kernels.#5902

Merged
piiswrong merged 3 commits intoapache:masterfrom
DickJC123:avoids_L1_dgrad
Apr 22, 2017
Merged

Avoids running unneeded backprop kernels.#5902
piiswrong merged 3 commits intoapache:masterfrom
DickJC123:avoids_L1_dgrad

Conversation

@DickJC123
Copy link
Copy Markdown
Contributor

Within CuDNNConvolutionOp.Backward(), this adds checks to avoid launching backprop kernels unnecessarily (i.e. when req[] == kNullOp). This would result typically in avoiding the L1 dgrad kernel launch in CNN's.

typename DataType<DType>::ScaleType beta = 0.0f;
typename DataType<DType>::ScaleType beta_add = 1.0f;
if (!param_.no_bias) {
CHECK_NE(req[conv::kBias], kNullOp);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why check instead of if?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was introduced to mirror the handling seen in cudnn_deconvolution-inl.h. To summarize the behavior as coded here for the 4 possible cases:

param_.no_bias == true, req[conv::kBias] == kNullOp - avoids backward-to-bias kernel
param_.no_bias == true, req[conv::kBias] != kNullOp - avoids backward-to-bias kernel
param_.no_bias == false, req[conv::kBias] == kNullOp - throws exception
param_.no_bias == false, req[conv::kBias] != kNullOp - runs backward-to-bias kernel

Would you prefer a different behavior?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be
if (!param_.no_bias && req[conv::kBias] != kNullOp)

@piiswrong piiswrong merged commit 7bbcbef into apache:master Apr 22, 2017
Guneet-Dhillon pushed a commit to Guneet-Dhillon/mxnet that referenced this pull request Sep 13, 2017
* Avoids running unneeded backprop kernels.

* Permits convolution bias that is not backpropped to.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants