This is an automated email from the ASF dual-hosted git repository.
haibin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new f9c436b Fix req=null in SliceLikeBackward (#14209)
f9c436b is described below
commit f9c436be2689ac809aab5422b41f2fd768e8c4bc
Author: Przemyslaw Tredak <[email protected]>
AuthorDate: Tue Feb 19 16:03:36 2019 -0800
Fix req=null in SliceLikeBackward (#14209)
---
src/operator/tensor/matrix_op-inl.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/operator/tensor/matrix_op-inl.h
b/src/operator/tensor/matrix_op-inl.h
index 97c4fa5..28ed421 100644
--- a/src/operator/tensor/matrix_op-inl.h
+++ b/src/operator/tensor/matrix_op-inl.h
@@ -1389,13 +1389,15 @@ void SliceLikeBackward(const nnvm::NodeAttrs& attrs,
CHECK_EQ(inputs.size(), 1U);
CHECK_EQ(outputs.size(), 2U);
CHECK_EQ(req.size(), 2U);
- if (req[0] == kNullOp) return;
using namespace mshadow;
Stream<xpu>* s = ctx.get_stream<xpu>();
+ if (req[1] != kNullOp && req[1] != kAddTo) {
+ Fill(s, outputs[1], req[1], 0); // Second input not relavant to gradients.
+ }
+ if (req[0] == kNullOp) return;
const TBlob& ograd = inputs[0];
const TBlob& igrad = outputs[0];
const SliceLikeParam& param = nnvm::get<SliceLikeParam>(attrs.parsed);
- Fill(s, outputs[1], req[1], 0); // Second input not relavant to gradients.
if (req[0] == kWriteTo) {
Fill(s, igrad, req[0], 0);
} else if (req[0] == kWriteInplace) {