lobanov-m commented on a change in pull request #13226: [MXNet-1211] Factor and
"Like" modes in BilinearResize2D operator
URL: https://github.com/apache/incubator-mxnet/pull/13226#discussion_r236169303
##########
File path: src/operator/contrib/bilinear_resize-inl.h
##########
@@ -105,8 +131,11 @@ inline void BilinearSampleOpBackward(const
nnvm::NodeAttrs& attrs,
const std::vector<TBlob> &inputs,
const std::vector<OpReqType> &req,
const std::vector<TBlob> &outputs) {
- CHECK_EQ(inputs.size(), 1U);
- CHECK_EQ(outputs.size(), 1U);
+ const BilinearSampleParam& param =
nnvm::get<BilinearSampleParam>(attrs.parsed);
+ CHECK_EQ(inputs.size(), 1);
+ bool modeLike = param.mode == bilinear_resize::like;
+ size_t expected = modeLike ? 2 : 1;
+ CHECK_EQ(outputs.size(), expected);
Review comment:
There are two outputs of the backward function. The operator still has one
output. In "like" mod we pass two input tensors to resize one to the size of
second, so the backward function should return gradients to both tensors.
Actually the second tensor, from which we get result size, should get zero
gradients from the output of this operator, because it is needed only to get
it's shape. It is realized in cc and cu files.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services